PHP 7 is coming soon
After a few RCs, PHP 7 will be officially released on November 12, 2015. This is a major release of PHP since PHP 5.6. @Laruence, one of the core contributors of PHP, has posted this news on Weibo(China's Twitter).
This is a one month later than the expected time as recorded in PHP 7 timeline. But it's not that late.
The new release will come with a few features including:
- Scalar type declaration, you can define variable like int now
- Return type support. Besides declare scalar type for variable, you can return typed data from function as well
- Null coalesce operator(??). It is a syntactic sugar to replace isset() function to check whether a variable is set and is not NULL
- Spaceship operator(<=>). The spaceship operator is used for comparing two expressions. It returns -1, 0 or 1 when $a is respectively less than, equal to, or greater than $b.
- Constant arrays using define(). Similar to enum in Java.
- Anonymous class. Support for anonymous classes has been added via new class. These can be used in place of full class definitions for throwaway objects:
- Unicode codepoint escape syntax. This takes a Unicode codepoint in hexadecimal form, and outputs that codepoint in UTF-8 to a double-quoted string or a heredoc.
- Closure::call(). Closure::call() is a more performant, shorthand way of temporarily binding an object scope to a closure and invoking it.
- Filtered unserialize(). This feature seeks to provide better security when unserializing objects on untrusted data. It prevents possible code injections by enabling the developer to whitelist classes that can be unserialized.
- IntlChar. The new IntlChar class seeks to expose additional ICU functionality. The class itself defines a number of static methods and constants that can be used to manipulate unicode characters.
- Expectations. Expectations are a backwards compatible enhancement to the older assert() function.
- Group use declarations. Classes, functions and constants being imported from the same namespace can now be grouped together in a single use statement.
- Generator Return Expressions.
- Generator delegation
- Integer division with intdiv(). The new intdiv() function performs an integer division of its operands and returns it.
- New enhancement for sessions.
So just be ready and download and start to use the new PHP 7 in a few days.
UPDATE: @Laruence has just updated his Weibo and said that the release date for PHP 7 has been changed to November 26, 2015. So be patient for a few more days.