Chike Mgbemena has posted a great guide for those out there still getting familiar with what PHP 7 has to offer and things to watch for when migrating your PHP 5.x code up to this latest version.
PHP 7 was released on 03 Dec 2015, and so many people have not yet started using or learning about the awesome features it has. I wrote this post to give a breakdown of the features released with PHP 7 for those that have not yet learnt about them and even if you know it, you might still learn something from this post.
Rasmus Lerdorf (creator of PHP) claims that apps running PHP 7 performance is improved by 100% or more. Memory usage is lower also, so if you are running a lot of servers, PHP 7 is an essential upgrade. One of the big changes in PHP 7 is the refactored ZEND Engine(PHPNG) which is now faster, memory usage reduced and a “green” version of PHP which makes you run less hardware to run your code.
He starts with a list of things that have been removed from PHP 7 including the MySQL extension (not mysqli), posix regular expression handling and the deprecation of the "salt" option in password hashing. He goes on to talk about some of the new things that come with PHP 7 including:
- the "spaceship" operator
- allowing constants to be defined as arrays (previously just strings)
- the random_bytes and random_integer functions
He also covers one of the most major changes in PHP 7: the inclusion of type hinting and checking, generators, error handling updates and a few other miscellaneous changes.