We all know that PHP keeps evolving. Every new major release there are new features. We Still do not know the whole features of PHP7 because the whole features is not described yet. PHP 7 was led by Zend to speed up the PHP applications, is based on the PHPNG (PHP Next-Gen) project. Since PHPNG is an open sourced and now mingle with PHP 7, its performance becomes more than doubled.
Now we can describe about some of the top features of PHP7 that is already implemented. Here we are going to discuss about the 5 top features of PHP7.s
Performance Improvements
The main goal of PHPNG was to bring performance improvements in the application such as WordPress, Drupal or SugarCRM. The main basis of the PHP7 is the improved codebase, importantly it reduces memory consumption.
The biggest feature of PHP 7 is the performance improvements due to major work on its Zend Engine, which will be Zend Engine 3 with PHP 7. The Performance Improvements is happening in PHP7 with the addition of PHPNG engine.
JIT Engine (Just In Time compilation)
The development of PHPNG was started with the inspiration to research the execution of a JIT Engine for the Zend Engine based PHP. The JIT engine can dynamically compile Zend opcodes into a native machine code that eventually would make the code run faster next time it is run.
While the JIT engine implementation is not yet built-in the PHPNG branch, but it is definitely in the plans of Zend to allow bringing a JIT engine to PHP 7.
AST: Abstract Syntax Tree
The another main feature of PHP7 is the implementation of the AST (Abstract Syntax Tree), It is not the first time Nikita Popov proposed the implementation, He has already proposed the Abstract Syntax Tree as an intermediary step for the PHP compilation process in 2012.
He described the several advantages of AST in his proposals, the main advantage of AST is its potential for more optimizations that would make PHP run even faster and now In the latest proposal he describes the possibility to expose the AST to PHP extensions and userland applications. That could open space for more interesting tools like static code analyzers which are often useful to detect bugs or potential source level optimizations of your PHP code.
Asynchronous Programming
Julien Pauli, one of the maintainers of the latest PHP releases, has been commenting about refactoring PHP I/O multiplexing layer. That is some changes in the code that takes care of handling events related to accesses to files, network, databases, timers, etc.
Simply we can say that asynchronous programming would allow future PHP version to easily implement support to the execution of parallel tasks within the same request, hence the performance of the PHP improved completely to another stage
To get the support for asynchronous programming, New PHP code needs to be written for taking the advantage of the asynchronous programming potential. It doesn’t mean that asynchronous programming built-in support will be enabled in PHP 7.
Standalone Multi-threading Web Server
By the standalone multi-threading webserver PHP would become more scalable. Already PHP can run from the multi-threaded web servers like ngynx, lighttpd or even Apache in worker mode. But it is much better for having PHP run on its own multi-threading web server. With the help of a single memory pool a multi-threading web server can handle many simultaneous requests by avoiding the memory waste when you run PHP as FastCGI or in Apache pre-fork mode.
This Standalone Multi-threading Web Server allow PHP to use a single pool of database connections, it helps during access peaks by minimizing the number of simultaneous database connections
In the making plan of PHP 7, standalone multi-threading Web server is not yet in the plans but it is good to have this multi-threading Web server in PHP 7.
Spaceship Comparison Operator
In PHP 7, they are going to introduce a new operator <=> for combined comparison. This operator is quite similar to these functions, strcmp() or version_compare(). These upcoming Spaceship Comparison Operator is mostly used when dealing with sorting and can be used for all generic PHP values with the same semantics as <, <=, ==, >=, >.
Return Type Declaration & Scalar Type Hints
Finally PHP gets return types, In PHP 7 we will able to indicate proper return types on functions in the form of:
function foo(): array {
return [];
}
In addition, new scalar type hints are supported by the argument type hints and the new return-type declarations, it allows the developers to denote that they are awaiting strings, int, bools, etc.
[box]PHP 7 Releasing ScheduleThe releasing date of PHP is not yet declared but we can assume that the PHP 7.0 would release in late 2015. According to the PHP timeline they aims to release PHP 7 in October 2015. Even the releasing date may be delayed, it doesn’t go much far. The releasing will be before the end of the year.[/box]