PHP 5.3 nearing final release

This week, the PHP.net team announced the fourth release candidate of PHP 5.3.0. This was just a week after the announcement of the third release candidate. Personally, I cannot wait to get my hands on the final version of PHP 5.3. This version will bring some long awaited features to the language.

I am the most excited about the possibilities of namespaces, the new syntax for anonymous functions and the possibilities of late static binding. Namespaces will of course enable the upcoming use of frameworks such as Zend Framework) and, when implemented by the currently existing frameworks, enable you to mix and match separate frameworks, even if they share classes with the same name.

The new syntax for anonymous functions will finally enable me to remove the ugly create_function() calls from my source code, and just use the new syntax. This will also enable a performance improvement since these functions are now compiled when the PHP file is compiled, in stead of when the PHP file is running. Opcode caches such as APC and Zend Optimizer should be able to benefit from this. Especially anonymous sorting functions, which are called many times (for example, with usort()), should benefit from this. Finally, this will enable the use of array_map instead of foreach in this way:

$all_escaped = array_map(function ($value) { return htmlentities($value, ENT_QUOTES, mb_internal_encoding());}, $input_array);

The last point I would like to mention is late static binding, which will finally allow me to write an abstract base class for singletons and extend from that, instead of endlessly copying this code because the keyword self does not resolve correctly.

Advertisement

About this entry