PHP 5.4 was released at the start of March and heralds a key new feature which I have long bemoaned the lack of: traits.
A Trait is intended to reduce some limitations of single inheritance by enabling a developer to reuse sets of methods freely in several independent classes living in different class hierarchies.
I’ve banged my head against the desk a number of times trying to work around the lack of traits in PHP and I hope PHP 5.4 makes its way into mainstream Linux distributions a lot quicker that 5.3 did.
There are also a number of other interesting features which look really cool:
- Simpler array dereferencing:
$secondElement = getArray();
- A shortened array syntax:
$a = [ "foo" => "bar", "bar" => "foo" ];
- A built in web server (for development) which could be really interesting – see here.