Learn what's new in PHP 7

Review all the new features that are coming in PHP 7 and get your app's up to speed.
4.6 (152 ratings)
Instead of using a simple lifetime average, Udemy calculates a
course's star rating by considering a number of different factors
such as the number of ratings, the age of ratings, and the
likelihood of fraudulent ratings.
7,788 students enrolled
Start Learning Now
  • Lectures 26
  • Length 3.5 hours
  • Skill Level Intermediate Level
  • Languages English
  • Includes Lifetime access
    30 day money back guarantee!
    Available on iOS and Android
    Certificate of Completion
Wishlisted Wishlist

How taking a course works


Find online courses made by experts from around the world.


Take your courses with you and learn anywhere, anytime.


Learn and practice real-world skills and achieve your goals.

About This Course

Published 4/2016 English

Course Description

PHP7 is the newest edition of the language to hit the server side in 2016. This well established and much loved language is providing significant performance improvements, providing new features and improving security. PHP has always been the goto language when it comes to server side database interactivity and data integrity with simplicity and ease of use.

The first and most prominent speed increase is the PHP7 engines speed which is nearly double the performance of the previous PHP 5.6 engine. This alone should be coveted by developers who don't even need to optimise their code but just to run it in the new engine and see massive performance increases. Wordpress, Joomla and other popular CMS's have been run out of the box with no code changes and huge performance increases have been seen with no optimisation needed at all.

But what about the other features and your script's, Will they work? Well to find out I'll be showing you additional features which may not be that dramatic after all. New features are always fun to learn but some new features will just be a simple parameter being passed into an already existing function. For example the unserialise function will now accept another optional parameter to only unserialise an object that came from a particular class; making it a little more secure. Also as we're on the topic of security and parameters the existing password hash function will no longer accept a salt but rather it will automatically generate a secure salt for you.

The new PHP version is a nice addition to the PHP family with refined features all round. PHP will still be around despite what developers say. It's still currently the best and most secure language for database interaction with PDO, scalar data validation, prepared statements, secure password hashing and salting. It really is still the king pin! Every language has it's place and PHP is firmly settled in on the server side and despite being a Javascript developer it's still is a very established language.

What are the requirements?

  • Understand the basics of PHP
  • Know about XAMPP or a similar service

What am I going to get from this course?

  • new features PHP 7
  • Deprecated features in PHP 7

Who is the target audience?

  • Exisiting PHP developers who want to learn whats coming
  • Someone who's learnt the basics of PHP and wants to further their understanding

What you get with this course?

Not for you? No problem.
30 day money back guarantee.

Forever yours.
Lifetime access.

Learn on the go.
Desktop, iOS and Android.

Get rewarded.
Certificate of completion.


Section 1: Getting setup

Welcome to this course, I'll first introduce myself and why you should want to take this course. Also give you some knowledge about what you'll need to take this course.


Before we being lets take a look at XAMPP where we want to setup PHP7 which you must download the correct version to take this course.

Section 2: PHP 7 new features

Scalar is a popular language that has some type declarations for arguments; now this is available in PHP. This will make your functions more structured and coerce the parameter data types to be what you want.


This lecture will cover type coercion of object data passed to our functions arguments.


PHP 7 supports data type declarations for values returned from a function. Similar to argument type declarations, return type declarations specify the type of the value that will be returned from a function.


Some lovely sugar syntax for PHP developers. Instead of if statements and writing unnecessary code but rather in one line we can optionally define the value of variable.


The spaceship operator is good for doing a comparison of two numbers and returns differing values depending on the comparison.


Array constants can now be defined with define(). In PHP 5.6, they could only be defined with const.


Support for anonymous classes has been added via new class. These can be used in place of full class definitions for throwaway or framework objects.


PHP7 now lets you use unicode characters escaped by UTF-8 in the hexadecimal format.


Your function's can be invoked with a predefined value for the this context; set by the call method. This is very similar to JavaScripts call method and works in the same way.


This feature seeks to provide better security when unserializing objects on untrusted data. It prevents possible code injections by enabling the developer to whitelist classes that can be unserialized.

Expectations are a backwards compatible enhancement to the older assert() function. They allow for zero-cost assertions in production code, and provide the ability to throw custom exceptions when the assertion fails.

Classes, functions and constants being imported from the same namespace can now be grouped together in a single use statement.


The new intdiv() function performs an integer division of its operands and returns it.


The session start function now accepts an array of options that override the session configuration directives normally set in php ini file.

Two new functions have been added to generate cryptographically secure integers and strings in a cross platform way: random_bytes() and random_int().

The new preg_replace_callback_array() function enables code to be written more cleanly when using thepreg_replace_callback() function. Prior to PHP 7, callbacks that needed to be executed per regular expression required the callback function to be polluted with lots of branching.

Section 3: PHP Generators

Generator functions are a new way of programming. They allow us to control the execution of a function and even change the state of the function in mid execution.


We've discovered generator functions allow you to pause and give way to other processing providing flexibility in programming. Lets delve into the syntax of generators and see how PHP works with them.


Generators allow for yielding values so that you can evaluate and use that value outside of the generator function.


Next we want to take a look at all the different primitive types like string, integer, float or bool and objects such as a class object, array or associative array.


Generators where introduced in PHP5.5 but in PHP7 and above there are new features we can work with. Such as return statements and yielding from other yield functions.

Section 4: PHP 7 deprecated features

[DEPRICTAED] Style constructors

PHP 4 style constructors (methods that have the same name as the class they are defined in) are deprecated. PHP 7 will return an E_DEPRECATED please only use the __construct() method.

[DEPRICATED] Static calls to non-static methods

Static calls to methods that are not declared static are deprecated, and may be removed in the future.

[DEPRICATED] Password hash

The salt option for the password_hash() function has been deprecated to prevent developers from generating their own (usually insecure) salts. The function itself generates a cryptographically secure salt when no salt is provided by the developer - therefore custom salt generation should not be needed.

[DEPRICATED] Capture session meta data

The capture_session_meta SSL context option has been deprecated. SSL metadata is now available through thestream_get_meta_data() function.


Thank you for taking this course and I hope to see you using PHP 7 at its best in the future.


Get any course from myself at 50% off the standard value!

Students Who Viewed This Course Also Viewed

  • Loading
  • Loading
  • Loading

Instructor Biography

Lawrence Turton, Technical Instructor

Lawrence Turton works as a web developer & graphic designer specialising in HTML, CSS, jQuery, UI & UX design. He has previously worked with Fifteendesign producing websites, iPhone and Android apps and started his own agency in 2010 called Elite Web Design. During that time Lawrence has established a wide range of clients from blue chip companies to large corporations. From a young age he was an online instructor and started to work with two of the leading online training specialists Cartoonsmart and Envato. Lawrence always created projects involving designs in Photoshop and bringing his creations to life by coding them with web technologies. This gives him a unique perspective into real world projects from start to finish and a wealth of information for new comers to the web industry.

Ready to start learning?
Start Learning Now