If you're looking to get an upperhand and cut some corners with your PHP development, you may be interested in giving PHP 5.6 beta a spin.

What's New in PHP 5.6 for Web Developers

Although there is no official release date as of yet, there is already a swarm of great new features that are definitely not worth playing around with before the official release.

Farewell Raw Post Data

So far PHP 5.6 only see's two deprecated functions, one of them being the deprecation of the $HTTP_RAW_POST_DATA which is expected to be removed in a future release.

Changes to File Uploads

Prior to PHP 5.6, no uploads over 2GB were possible due to their poor handling and processing. However, the PHP team have now outlined that uploads of arbitrary size are now fully supported. In addition to this, the POST data memory usage has been shrunk by 2 - 3 times its predecessor. This reduction in memory footprint comes following the removal of the raw post data mentioned above.

These changes that rely on accessing php://input to read the data mean that you're now able to reopen and reuse the input as many times as required, aiding the memory footprint reduction.

Variadic Functions

For those wondering what variadic functions are - they're those that accept a variable length of arguments on each call.

# Prior to PHP 5.6
function variadic($integer) {
	return $integer + array_sum(array_slice(func_get_args(), 1));
# In PHP 5.6
function variadic($integer, ...$params) {
	return $integer + array_sum($params);
# Example Calls
variadic(1); # Returns 1
variadic(1, 2); #Returns 3
variadic(1, 2, 3); # Returns 6

Using the new syntax, PHP will assign the first variable $integer and then place any other parameters into the $params variable. Removing the need of calling func_get_params. This also allows us to conserve our memory footprint by passing the parameters over by reference with the ampersand syntax of &...$params.

Argument Unpacking via ...

When you call a function using the new ... syntax you can unpack array and traversable objects into argument lists. For those that program in Ruby, this is known as the splat operator.

Given the example from PHP.net, we create a function which accepts three parameters and then returns the sum of them.

function add($a, $b, $c) {
    return $a + $b + $c;
# A very simple call:
add(1, 2, 6); # Returns 6

As of PHP 5.6, we're able to pass over arrays or traversable objects:

# Using the new syntax of PHP 5.5
$numbers = [1, 2, 3];
# The array is unpacked and passed over

Want to find out more? Read about PHP argument unpacking on their RFC.

Importing Namespaced Constants and Functions

With PHP 5.6 you're able to import namespaced constants and functions directly into other classes which expands on what is currently possible; being able to import namespaces and types such as classes, interfaces and traits.

namespace NamespaceTest {
	const SCORE = 1;
	function getScore() {
		# ...
namespace {
	use NamespaceTest  as Test;

From PHP 5.6 we're able to use the use function and use const statements to import standalone segments of code:

namespace {
	use function NamespaceTestgetScore;
	use const NamespaceTestSCORE;

Default Character Encoding

The default value of the character encoding has been changed to 'UTF-8' and can be controlled by accessing default_charset(). Updating the default value is reflected in the mbstring and iconv modules in addition to htmlentities, htmlspecialchars and html_entity_decode.

PHPDBG Interactive Debugging

The phpdbg debugger is now bundled by default as SAPI module (Server API). You can access it from the command line and step through your code at runtime, inspecting breakpoints or Opcode cache generated.

Under the Bonnet

PHP 5.6 includes updates to OpenSSL for SSL/TLS improvements, Zip for on-the-fly password protecting archives and Crypto hashing updates.

Ignite your brand, utilise user-generated content no matter where you or your audience are ›