Short summary with commonly used new features for PHP 7.0-7.2
PHP 7.0
Selected changes for PHP 7.0 with short examples. More informations can be found on:
http://php.net/manual/en/migration70.new-features.php
Scalar type declarationsbool, float, int, string |
|
Strict types declarationWrong type of variable will cause exception |
|
Return type declarations |
|
Null coalescing operatorShortcut for conditional isset |
|
Spaceship operator: $a <=> $bIt returns -1, 0 or 1 when $a is respectively less than, equal to, or greater than $b |
|
Constant can return array |
|
Anonymous classes |
|
Filtered unserialize()allowed_classes default is false |
|
Group use declarations |
|
Generator Return Expressions |
|
Integer division with intdiv() |
|
PHP 7.1
Selected changes for PHP 7.1 with short examples. More informations can be found on:
http://php.net/manual/en/migration71.new-features.php
Nullable types |
|
Void functions |
|
Symmetric array destructuringfunction list can be replaced with [] |
|
Class constant visibility |
|
Multi catch exception handling |
|
Support for keys in list() |
|
Support for negative string offsets |
|
PHP 7.2
Selected changes for PHP 7.2 with short examples. More informations can be found on:
http://php.net/manual/en/migration72.new-features.php
New multibyte string functions |
|
New
|
|
Abstract method overriding |
|
Parameter type wideningParameter types from overridden methods and from interface implementations may now be omitted. |
|
Allow a trailing comma for grouped namespaces |
|
Add new comment
Comments
OS_C
Great summary! It helped me last time when I had an interview! Thanks!