Home » , » What You Get in PHP 5.5 & 5.6?

What You Get in PHP 5.5 & 5.6?

jaki watson | 23:26 | 0 comments

PHP 5.5 & 5.6 hire this Developer
PHP is one of the best server-sider scripting languages that used for developing robust web applications. PHP is the most recommended languages among web developers due to its concise syntax, powerful language constructs and rich function library.

Interestingly, more than 240+ million sites are powered by PHP and its every release comes with some improvements and advances. The latest version of PHP 5.5 and 5.6 comes with a collection of improvements. However, some backward incompatibilities are introduced that are worth cogitating.

Latest Features of 5.5

Generators added

A special function, Generator is used to boost the repetition behavior of a loop statement.

It seems like a same function that return a sequence and an array of values rather than returning all values at once. It uses less memory and processing time as it returns values at a single time.

It is considered as one of the powerful language feature that has been available in other languages like Python. And, now it is available in PHP.

Through the yield keyword, one can able to add support for generators. It provides an effective ways to implement simple iterators without the overhead or complexity of applying a class that the Iterator interface is implemented.

New password hashing API

With the help of new password hashing API, one can easily secure hash and manage passwords by using the same underlying library that used as crypt() in PHP. Click here for more information.

for each now supports list()

Unpacking nested arrays into separate variables is supported by the foreach control structure through the list() construct. See example given below:

You can check documentation on the foreach manual page.

empty() supports arbitrary expressions

Using a variable instead of passing an arbitrary expression to empty() is supportable. For example:

array and string literal dereferencing

Now, array and string literals can be dereferenced for accessing individual characters and elements directly.

Class name resolution via ::class

Now, it is possible to utilize ClassName::class for getting a qualified class name ClassName.

OPcache extension added

Now, PHP comes with the Zend Optimiser+ opcode cache with the new OPcache extension. PHP performance can be improved by OPcache to store precompiled script bytecode in shared memory and thus, removing the requirements for PHP to load and parse scripts on each request.

For more information, check out the installation instructions on enabling and using OPcache.

Non-scalar keys are supported by foreach

Now, foreach supports keys of any type. It is possible for Iterator::key() to return a value of different type while non-scalar keys cannot happen in native PHP arrays and such thing will be managed properly.

Windows supports Apache 2.4 handler

Now, the Apache 2.4 handler SAPI is supported on Windows.

Improvements to GD

Different enhancements have been developed to the GD extensions like:

  • WebP read and write support using imagecreatefromwebp() & imagewebp() respectively.
  • Flipping support using the new imageflip() function.
  • Advanced cropping support using the imagecrop() & imagecropauto() functions.

Latest Features of 5.6

Now, one can easily get a scalar expression that includes numeric and string literals and/or constants in context, where PHP probable a static value like property declaration, constant, default function arguments.

Moreover, it is now possible to define a constant array by using the the const keyword 

Variadic functions via ...

Now, one can easily implement variadic functions by using the …operator rather than relying on func_get_args().

Argument unpacking via ...

When developers call functions by using the ... operator, Arrays and Traversable objects can be unloaded into argument lists. In other language like Ruby, we can call it the splat operator.

Exponentiation via **

In order to support exponentiation, a proper associative ** operator has been added with a **= shorthand assignment operator

use function and use const

The use operator has been spread to provide support for importing functions and constants with classes. Such thing can get through the use function and use const constructs, respectively.


Developers can also find an interactive debugger, which is better known as phpdbg implemented in PHP as a SAPI module. If you want to know more about it then click on phpdbg documentation.

Default character encoding
Now, one can use default_charset as the default character set for the htmlentities(), html_entity_decode() and htmlspecialchars() functions.


If iconv and mbstring encoding settings are all set then they will choose preference over default_charset for iconv and mbstring functions, respectively. UTF-8 is the default value for this setting.

php://input is reusable

Now, php://input may be regenerated and read as many time as one can needed. Such thing has result into huge reduction in the amount of memory needed to deal with POST data.

Large file uploads

In PHP 5.6, more than 2 gigabytes files in sizes are accepted.

Operator overloading supported by GMP

Operator overloading and casting supported by GMP objects to scalar types. Such things allow more cost code by using GMP:

hash_equals() for timing attack safe string comparison

In order to compare two strings in contant time, hash_equals() function has been added. Such thing can be used for alleviating timing attacks for example: when testing crypt() password hashes.


In PHP 5.6, developers can find the __debugInfo() magic method that enables objects to change the properties and values that are displayed when the object is output by using var_dump().

gost-crypto hash algorithm

The gost-crypto hash algorithm has also been added that implements the GOST hash function by using the CryptoPro S-box tables as stated by » RFC4357, section 11.2.

SSL/TLS improvements

In PHP 5.6, one can find a collection of enhancements to the SSL/TLS support. Such things include support for certificate fingerprint matching, enabling peer verification by default, enabling peer verification by default, and so on that allowed more fine grained control over protocol and verification settings at the time of using encrypted streams.

pgsql async support

Asynchronous connections and queries are supported by the pgsql extension that enables non-blocking behavior when cooperating with PostgreSQL databases.

Asynchronous connections may be created through the PGSQL_CONNECT_ASYNC constant, and the new pg_socket(), pg_connect_poll(),pg_consume_input() and pg_flush() functions that may be used for handling asynchronous connections and queries.

These are some excellent features that we find in PHP 5.5 and PHP 5.6. if you want to update your website according to these updates then get service of PHP developers for hire from Perception System, a leading PHP website development service providers.

Share this article :


Post a Comment

Design by: