Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

PHP 5.5 introduced generators and coroutines, the finally keyword, a simplified password-hashing API, and a collection of syntax improvements. It also bundled Zend OPcache. PHP 5.5 is a historical release, not a current deployment target: PHP 5.5.0 was released on June 20, 2013, and PHP 5.5.38, the branch’s last planned release, followed on July 21, 2016.

What changed in PHP 5.5?

The PHP Development Team’s PHP 5.5.0 release announcement grouped the changes across language features, syntax, and runtime support. The most substantial additions affect control flow and everyday code expression.

Generators and coroutines

PHP 5.5 added generators and coroutines. Generators let code produce values one at a time as it is iterated, rather than requiring a function to build and return an entire collection first. This gives developers a way to express iteration without manually implementing an iterator for every sequence. The release announcement lists both generators and coroutines as additions.

The finally keyword

PHP 5.5 added finally to exception handling. A finally block provides a place for cleanup code that should run after the associated try and catch handling completes, such as releasing a resource. The announcement describes this addition as “Added the finally keyword.”

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Simplified password hashing API

The release introduced a simplified password-hashing API. The announcement characterizes it as a simpler API; it does not establish that PHP 5.5 was the first way to perform password hashing in PHP or make a comparative security claim.

Syntax changes that reduce boilerplate

PHP 5.5 also made several expressions shorter or more flexible. These changes can matter when reading code written for the release, even when they do not alter an application’s overall design.

  • Dereferencing: Array and string values can be dereferenced directly from constants, making it possible to access an element or character without first assigning the value to a variable.
  • Class names with ::class: Scalar class-name resolution lets code obtain a class name through the ::class syntax.
  • empty() on expressions: empty() can be used on function-call results and other expressions, not only variables.
  • More options in foreach: Non-scalar iterator keys are supported, and list() constructs can be used in foreach loops.

Zend OPcache became bundled

PHP 5.5.0 bundled Zend OPcache. According to the OPcache manual, the extension stores precompiled script bytecode in shared memory. That avoids loading and parsing each script on every request. The manual says OPcache is bundled with PHP 5.5.0 and later. This describes how the cache works; the release notes and manual do not provide a benchmark from which to claim a particular speed increase.

Compatibility changes and migration concerns

Platform and name-matching changes

The PHP 5.5.0 announcement lists three compatibility changes: PHP logo GUIDs were removed; Windows XP and Windows Server 2003 support was dropped; and case-insensitive matching of function, class, and constant names became locale-independent and followed ASCII rules. Applications that depended on the earlier platform support or locale-sensitive name matching could therefore need review when moving to 5.5.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

The original mysql extension was deprecated

The original mysql extension was deprecated in PHP 5.5.0 and removed in PHP 7.0.0. The PHP documentation on choosing a MySQL API points developers to MySQLi or PDO_MySQL instead. For a legacy application, this is an important migration issue: code using the old extension cannot rely on it when running under PHP 7.0 or later.

PHP 5.5 reached the end of its planned release line

The official PHP 5.5.38 announcement, published July 21, 2016, called the release a security release and the last planned release of the PHP 5.5 branch. It allowed for the possibility of further releases for important security issues; otherwise, 5.5.38 would be the final release. The announcement advised users to begin planning a move to PHP 5.6 or PHP 7.0. That was guidance written in 2016, not current version advice. The PHP release archive records PHP 5.5.0 on June 20, 2013, and PHP 5.5.38 on July 21, 2016.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

What PHP 5.5 means for legacy code

For developers maintaining code from the PHP 5.5 period, the release is useful context for understanding syntax and behavior the code may rely on: generators, finally, OPcache, and the added expression and iteration forms. Compatibility review should also account for the dropped older Windows support, ASCII-based locale-independent case matching, and the deprecation of the original mysql extension. Those historical details help explain older projects; they do not make PHP 5.5 an appropriate version to choose for a new deployment.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.