PHP is one of the most popular website development languages. This server-side scripting language is easy to understand, and over the years, has become the most preferred open source programming languages for developing websites. Starting from PHP version 3.0 when it was released, every new release has added newer features to it, making it a feature-packed powerhouse to create robust and dynamic websites.
On Nov 26, 2015 the company came out with the seventh Release Candidate as a precursor to the general release, which they have deferred by 2 weeks to fix a few blocker bugs. Nevertheless, we bring you the dope on what you can expect in the high performance upgrade to PHP 7.0.
Here’s the update on what is new with PHP 7.0.
1. Powered by a brand-new Zend engine – PHP has been powered by the Zend open source execution engine since it was released way back in 1999. The PHP 7.0 avatar comes with a brand new version of the Zend engine rightly called the PHPNG (PHP Next-Gen) project or .PHP#NG.
2. 2X speed and performance – The Zend engine comes with optimised memory usage. The just-in-time compilation (JIT) enables compilation at run time instead of prior to execution, which has led to whopping performance gains of anywhere between 25%-75% on real-world applications. As per this presentation on PHP.Net, PHP 7 has been able to handle twice as many requests on its content management system (CMS), compared to PHP 5.6, its predecessor. Thus, the performance is sometimes even doubled (in req./second). All that is required is a single upgrade.
3. New Operators – One of the most notable features of the PHP 7 is the addition of two new operators – spaceship and Null Coalesce. The spaceship operator is denoted by <=>, returns 0 if both operands are equal, 1 if the left is greater, and -1 if the right is greater. It’s also called a three-way comparison operator. The Null Coalesce operator (??) is used to check if a specific element exists.
4. 64-Bit OS Support – PHP’s native environment has been Linux since inception, though it was possible to run it on Windows system. PHP 7 will remedy this as it introduces consistent 64-bit support for both native 64-bit integers and large files – no more compatibility problems.
5. Return Types – PHP 7 enables developers to enhance the quality of their code with the help of return type declarations. This enables users to specify return types on functions, improving the current parameter type declarations, while providing support for integer, float, string and Boolean declarations.
6. Fatal Error Handling – All actions which resulted in “fatal errors” in PHP 5 will now throw catchable exceptions in PHP 7. The new Engine Exceptions permits one to substitute these kind of errors with exceptions. There are two different kinds of exceptions in error handling – traditional and engine exceptions.
7. Addition of Anonymous Classes – PHP 7 now allows use of anonymous classes, which is offered by most object-oriented languages like C# and Java. Use of anonymous classes can speed up coding as well execution time.