Image for post: PHP features history

PHP features history

We have PHP 7 but I was wondering how we can have a sort of timeline with the most important feature for each version of PHP. On php.net there is the release page but it's not enough for our purposes. From the history of PHP to the PHP museum, we can navigate and download the various PHP versions. WIth PHP 4 the language started to become popular and grow very fast. But this version is now old and even the documentation was removed from php.net.

PHP 5

PHP 5 introduced OOP and it's the most important PHP version. All new releases have very important news and sometimes we had problems adapting an application to PHP 5.5 for example. The 5.3 version is considered the first and most important stable release.

  • PHP 5.2
  • PHP 5.3
    • Introducing namespaces
    • Late static binding
    • Lambda Functions and Closures
    • Syntax additions: NOWDOC, ternary short cut "?:" and jump label (limited goto), __callStatic()
    • Under the hood performance improvements
    • Optional garbage collection for cyclic references
    • Optional mysqlnd PHP native replacement for libmysql
    • Improved Windows support including VC9 and experimental X64 binaries as well as portability to other supported platforms
    • More consistent float rounding
    • Deprecation notices are now handled via E_DEPRECATED (part of E_ALL) instead of the E_STRICT error level
    • Several enhancements to enable more flexiblity in php.ini (and ini parsing in general)
    • New bundled extensions: ext/phar, ext/intl, ext/fileinfo, ext/sqlite3, ext/enchant
    • Over 140 bug fixes and improvements to PHP, in particular to: ext/openssl, ext/spl and ext/date
  • PHP 5.4
    •  Short array syntax has been added, e.g. $a = [1, 2, 3, 4]; or $a = ['one' => 1, 'two' => 2, 'three' => 3, 'four' => 4];
    • Function array dereferencing has been added, e.g. foo()[0]
    • Closures now support $this
    • <?= is now always available, regardless of the short_open_tag php.ini option.
    • Class member access on instantiation has been added, e.g. (new Foo)->bar().
    • Class::{expr}() syntax is now supported
    • Binary number format has been added, e.g. 0b001001101
    • Improved parse error messages and improved incompatible arguments warnings
    • The session extension can now track the upload progress of files
    • Built-in development web server in CLI mode
  • PHP 5.5
    • Generators added
    • finally keyword added
    • New password hashing API
    • foreach now supports list()
    • empty() supports arbitrary expressions
    • array and string literal dereferencing
    • Class name resolution via ::class
    • OPcache extension added
    • foreach now supports non-scalar keys
    • Apache 2.4 handler supported on Windows
    • Improvements to GD
  • PHP 5.6
    • For more information about new features on this version, I suggest these 2 posts on TutsPlus and Sitepoint,
    • Constant expressions
    • Variadic functions via...
    • Argument unpacking via ...
    • Exponentiation via **
    • use function and use const
    • phpdbg
    • Default character encoding
    • php://input is reusable
    • Large file uploads
    • GMP supports operator overloading
    • hash_equals() for timing attack safe string comparison
    • __debugInfo()
    • gost-crypto hash algorithm
    • SSL/TLS improvements
    • pgsql async support

PHP 6

The missed an unreleased version. PHP 6 was in beta version and I think anyone used this version on production...

PHP 7

The biggest news is that PHP 7 increases the speed of web applications twice! With PHP 7 we have more data types and new important syntax news. New features:

  • Scalar type declarations
  • Return type declarations
  • Null coalescing operator
  • Spaceship operator
  • Constant arrays using define()
  • Anonymous classes
  • Unicode codepoint escape syntax
  • Closure::call()
  • Filtered unserialize()
  • IntlChar
  • Expectations
  • Group use declarations
  • Generator Return Expressions
  • Generator delegation
  • Integer division with intdiv()
  • Session options
  • preg_replace_callback_array()
  • CSPRNG Functions
  • list() can always unpack objects implementing ArrayAccess

Resources:

Dependencies

Until PHP 5 we had PEAR and PECL. Composer is ready to use with PHP > 5.3.2 and it represents the most useful and brilliant dependency manager for PHP.