New features in PHP 5.6

New features in PHP 5.6

There are some very exciting features  in PHP 5.6 release. In this article we will look into new features introduced in PHP 5.6.

File Upload Limit:

Before PHP 5.6 upload limit was less then 2 GB but in PHP 5.6 uploads over 2GB are supported.

Variadic Functions:

Varidaic functions are the functions that can take any number of arguments. Previously func_get_args was used when we have to pass arbitrary number of arguments.

Versions before PHP 5.6

echo sum(1, 4, 12, 20);

echo sum(1, 4, 12);

PHP 5.6

echo sum(1, 4, 12, 20);

echo sum(1, 4, 12);

Look at the function defination

Three dots (…) are used before the variable

This variable will accept arguments.

Constant Scalar Expressions

Before PHP 5.6 while declaring a constant we cannot use expressions for assigning a value to constant. but in PHP 5.6 we can now have basic arithmetic and logical structures in constant declarations, functions arguments, class properties etc.


PHPDBG bundled with PHP

phpdbg provides an interactive environment to debug PHP and is implemented as distributed as SAPI module, Just as a CLI interface.

you can read more detail about PHP DBG here.

Importing Namespaced Functions

Before PHP 5.6 to import namespaced  functions using  use statement

FBut now from PHP 5.6, we  can use  use function and use const statements to import a  function or constant from a namespace.



In next article we will explore more features introduced in PHP 5.6.  If you need a brief introduction about PHP then you can read this post.