PHP 5.4.0 Is Now Available

It’s been an exciting first quarter this year in technology. Apache HTTPD 2.4 was just released (Apache is a very popular web server and this was a significant upgrade), and now PHP 5.4.0 just went live.

PHP 5.4.0 is a big upgrade that I am very excited to start using. It includes a feature called traits that works like multiple inheritance, only horizontally not vertically. Anything that minimizes code reuse is a good idea in my mind.

The new version also includes a shortened array syntax, similar to languages like Python. I’ve been wanting that feature for a while now, as well as the ability to¬†array dereference the result of a function or method call directly, allowing you to use less code.

<?php
function array_dereference_test() {
    return array( 'value 1', 'value 2', 'value 3' );
}

echo array_dereference_test()[1]; // Echoes 'value 2'

There are a number of other features, such as the elimination of safe mode and register_globals, all good improvements as those features were security risks. I’d advise any PHP programmer to checkout the PHP 5.4.0 changelogs to see what is new.

Leave a Reply