PHP7 beta versions has already been released for testing. Now in mid October stable version of PHP7 is going to be released. This presentation is all about the new features of PHP7.
2. Applications running on PHP 5.6 will run at least twice as fast on
PHP 7.
It will have built-in cache.
30% less memory consumption.
Drupal 8 runs 72% faster with PHP 7.
PHP 7 is perfect for frameworks like Laravel and Zend
3.
4. PHP 7 handles more than twice as many requests per second,
which in practical terms will represent a 100% improvement on
performance for WordPress websites.
Will require less number of servers to cater more users on
WordPress.
5. Script Style Tags will be obsolete.(<% and <script language='php'>)
ereg_ functions will be removed and preg_ functions will be used.
MySQL functions will be removed instead MySQLi functions will be used.
Split will be removed instead explode will be used.
In PHP 7, multiple defaults will cause fatal error.
6. In PHP 7, we can’t use multiple switch statements.
It will cause fatal error.
7. PHP 7 has introduced new operators:
Spaceship Operator and Null Coalesce Operator.
Spaceship operator enables you to make comparison more concise.
Example:
$a <=> $b This expression will evaluate to -1 if $a is smaller
than $b, 0 if $a equals $b, and 1 if $a is greater than $b.
8. Null Coalesce operator(??) works as shortcut.
It will be helpful in checking conditional attribution.
Code in PHP5
$a = isset($b) ? $b : "default";
Same code in PHP 7 will be written as:
$a = $b ?? "default";
9. Scalar type hint feature will enable you to use floats, strings,
Booleans and integers as type hints for functions and methods.
It is being considered as the most debatable new feature in PHP 7.
10. With PHP 7 you can define the return type of methods and
functions.
It will act same as scalar type hints in regards of coercion and
strict mode.
Example:
<?php function a() : bool { return 1; } var_dump(a());
11. PHP 7 stable version is going to release in mid October.
However beta version is available for tests.
RFC should be checked for all changes coming in PHP 7.
12. PHP 7 focuses more on speed.
Avoid using scripts which will break in PHP 7.
The PHP 7 release will make the life of programmers much easier
through new features.