5.6.40

Latest release in branch 5.6
Released 7 years ago (January 10, 2019)

Software PHP
Branch 5.6
Status
End of life
End of bug fixes December 31, 2017
End of security fixes December 31, 2018
First official release version 5.6.0
First official release date 11 years ago (August 28, 2014)
Release notes https://www.php.net/ChangeLog-5.php#5.6.40
Source code https://github.com/php/php-src/tree/php-5.6.40
Documentation https://www.php.net/manual/en/
Download https://www.php.net/releases/5.6.40
PHP 5.6 Releases View full list

What Is New in PHP 5.6

Category Key Changes
New Features Constant scalar expressions, variadic functions, argument unpacking, exponentiation operator, __debugInfo() magic method, use function and use const
Improvements GMP operator overloading, file uploads larger than 2GB, better SSL/TLS defaults
Deprecated mysql_* functions, call_user_method() and call_user_method_array(), mcrypt_generic_end()
Security OpenSSL improvements, default_charset option

What new language features were introduced?

PHP 5.6 added several syntactic enhancements that make code more expressive and concise. You can now use constant scalar expressions in contexts like array keys and property declarations, which is handy for defining values based on simple calculations.

Variadic functions and argument unpacking with the ... operator simplify working with variable numbers of arguments. This replaces the old pattern of using func_get_args() and makes the intent clearer at the function signature.

// Variadic function
function sum(...$numbers) {
    return array_sum($numbers);
}
// Argument unpacking
$args = [2, 3];
echo pow(2, ...$args); // 8

The exponentiation operator ** provides a shorthand for mathematical power operations. The new __debugInfo() magic method allows objects to control their output when printed with var_dump().

How did imports change with use function and use const?

PHP 5.6 extended the use keyword to support importing functions and constants from namespaces. This helps avoid writing fully qualified names repeatedly, making code less verbose.

use function Namespace\functionName;
use const Namespace\CONST_NAME;

In practice, this is a quality-of-life improvement for code organization. It encourages better structure by making it easier to use individual components from namespaces without resorting to global aliases.

What improvements were made for developers?

The GMP extension gained operator overloading, allowing you to use arithmetic operators directly on GMP objects instead of calling functions like gmp_add(). This makes mathematical code with large integers much more readable.

PHP now supports file uploads larger than 2GB, which was a longstanding limitation. The php.ini settings post_max_size and upload_max_filesize can handle values greater than 2GB.

SSL/TLS defaults were improved to enable peer verification by default and support certificate fingerprint verification. This matters because it pushes developers toward more secure out-of-the-box configurations for network operations.

What was deprecated and why?

The old mysql_* functions were officially deprecated in favor of MySQLi or PDO_MySQL. This was the final push to move developers away from the outdated extension that lacked modern features like prepared statements.

call_user_method() and call_user_method_array() were deprecated in favor of call_user_func() and call_user_func_array(). The deprecated functions were just aliases that added unnecessary complexity to the language.

mcrypt_generic_end() was deprecated in favor of mcrypt_generic_deinit(), which had a clearer name. The mcrypt extension itself was already on its way out due to better alternatives becoming available.

FAQ

Should I upgrade from PHP 5.5 to 5.6?
Yes, the upgrade is relatively smooth and brings worthwhile language improvements. The new syntax features like variadic functions and the exponentiation operator can make your code cleaner. Just be prepared to address any deprecated function usage.

How do I handle the deprecated mysql extension?
Migrate to either MySQLi or PDO_MySQL. Both offer prepared statements which are more secure. The conversion is straightforward but requires testing since the APIs are different.

What's the benefit of the exponentiation operator?
It provides a cleaner syntax for power operations. Instead of writing pow(2, 3), you can now use 2 ** 3. It's a small change that improves readability for mathematical code.

Can I really upload files larger than 2GB now?
Yes, this limitation was removed. You'll need to ensure both post_max_size and upload_max_filesize in your php.ini are set to values greater than 2GB to take advantage of this.

What does the __debugInfo() method do?
It allows objects to control which properties are shown when var_dump() is called on them. You can use it to hide sensitive data or format debug output more usefully.

Releases In Branch 5.6

Version Release date
5.6.40 7 years ago
(January 10, 2019)
5.6.39 7 years ago
(December 06, 2018)
5.6.38 7 years ago
(September 13, 2018)
5.6.37 7 years ago
(July 19, 2018)
5.6.36 7 years ago
(April 26, 2018)
5.6.35 8 years ago
(March 29, 2018)
5.6.34 8 years ago
(March 01, 2018)
5.6.33 8 years ago
(January 04, 2018)
5.6.32 8 years ago
(October 26, 2017)
5.6.31 8 years ago
(July 06, 2017)
5.6.30 9 years ago
(January 19, 2017)
5.6.29 9 years ago
(December 08, 2016)
5.6.28 9 years ago
(November 10, 2016)
5.6.27 9 years ago
(October 13, 2016)
5.6.26 9 years ago
(September 15, 2016)
5.6.25 9 years ago
(August 18, 2016)
5.6.24 9 years ago
(July 21, 2016)
5.6.23 9 years ago
(June 23, 2016)
5.6.22 9 years ago
(May 26, 2016)
5.6.21 9 years ago
(April 28, 2016)
5.6.20 10 years ago
(March 31, 2016)
5.6.19 10 years ago
(March 03, 2016)
5.6.18 10 years ago
(February 04, 2016)
5.6.17 10 years ago
(January 07, 2016)
5.6.16 10 years ago
(November 26, 2015)
5.6.15 10 years ago
(October 29, 2015)
5.6.14 10 years ago
(October 01, 2015)
5.6.13 10 years ago
(September 03, 2015)
5.6.12 10 years ago
(August 06, 2015)
5.6.11 10 years ago
(July 10, 2015)
5.6.10 10 years ago
(June 11, 2015)
5.6.9 10 years ago
(May 14, 2015)
5.6.8 11 years ago
(April 16, 2015)
5.6.7 11 years ago
(March 19, 2015)
5.6.6 11 years ago
(February 19, 2015)
5.6.5 11 years ago
(January 22, 2015)
5.6.4 11 years ago
(December 18, 2014)
5.6.3 11 years ago
(November 13, 2014)
5.6.2 11 years ago
(October 16, 2014)
5.6.1 11 years ago
(October 02, 2014)
5.6.0 11 years ago
(August 28, 2014)