Tuesday, July 28, 2015

PHP 7 is coming

As of 2014, work is underway on a new major PHP version named PHP 7. There was some dispute as to whether the next major version of PHP was to be called PHP 6 or PHP 7. While the PHP 6 unicode experiment had never been released, a number of articles and book titles referenced the old PHP 6 name, which might have caused confusion if a new release were to reuse the PHP 6 name.[37] After a vote, the name PHP 7 was chosen.[38]
PHP 7 gets its foundations from an experimental PHP branch that was originally named phpng (PHP next generation), which aims at optimizing PHP performance by refactoring the Zend Engine while retaining near-complete language compatibility.[39] As of 14 July 2014, WordPress-based benchmarks, which serve as the main benchmark suite for the phpng project, show an almost 100% increase in performance. Changes from phpng are also expected to make it easier to improve performance in the future, as more compact data structures and other changes are seen as better suited for a successful migration to a just-in-time (JIT) compiler.[40] Because of the significant changes, this reworked Zend Engine will be called Zend Engine 3, succeeding the Zend Engine 2 used in PHP 5.[41]
Because of phpng's major internal changes, it would have to go into a new major version of PHP, rather than a minor 5.x release, according to PHP's release process,[42] thus spawning PHP 7. Major versions of PHP are allowed to break code backwards-compatibility, and so PHP 7 presented an opportunity to make other improvements beyond phpng that require backwards-compatibility breaks. In particular, the following backwards-compatibility breaks were made:
  • Many "fatal" or "recoverable"-level legacy PHP "errors" were replaced with modern object-oriented exceptions[43]
  • The syntax for variable dereferencing was reworked to be more internally consistent and complete, allowing the use of->[](){}, and :: operators with arbitrary meaningful left-hand-side expressions[44]
  • Support for legacy PHP 4-style constructor methods was deprecated[45]
  • The behaviour of the foreach statement was changed to be more predictable[46]
  • Constructors for the few classes built-in to PHP which returned null upon failure were changed to throw an exception instead, for consistency[47]
  • Several unmaintained or deprecated SAPIs and extensions were removed from the PHP core, most notably the legacymysql extension[48]
  • The behaviour of the list() operator was changed to remove support for strings[49]
  • Support for legacy ASP-style PHP code delimeters (<% and %><script language=php> and </script>) was removed[50]
  • An oversight allowing a switch statement to have multiple default clauses was fixed[51]
  • Support for hexadecimal number support in some implicit conversions from strings to number types was removed[52]
  • The left-shift and right-shift operators were changed to behave more consistently across platforms[53]
  • Conversions between integers and floating point numbers were tightened and made more consistent across platforms[53][54]
PHP 7 will also include new language features. Most notably, it will introduce return type declarations,[55] which will complement its existing parameter type declarations, and support for the scalar types (integer, float, string and boolean) in parameter and return type declarations.[56]

Sourced from Wikipedia on July 29, 2015

No comments:

Post a Comment