An alpha version of PHP 5.4 has been released to the public on php.net. PHP 5.4 alpha 2 is available for download from qa.php.net.
The PHP 5.4 alpha was first released 26 June 2011. The proposed release date for PHP 5.4 is 26 July 2011. (Source: “PHP” on Wikipedia.)
PHP 5.4’s features include:
- better performance
- lower memory usage
- array dereferencing – you don’t need to store an array before access, so code like get_person_by_id(5)[‘address’] is now possible; Razvan Tudorica gives a straightforward example of array dereferencing
- traits, essentially a mechanism for two classes with a common parent class to still share some common methods – very useful – Simias Toleikis explains traits very well
- support for DTrace for real time tracing of PHP processes
There’s also been some cleanup to improve the security and code quality of PHP:
- syntax for continue/break $var removed
- register_long_arrays, allow_call_time_pass_by_reference and register_globals configuration parameters have been removed
- session_registered(), session_is_registered(), session_unregister() have been removed
- support for old sqlite databases has been moved to PECL; sqlite3 support is still built in
Big features like Unicode in the core and performance acceleration from having APC built in looks like they’ll wait until PHP 6 is released.