Chin Lee


PHP 5.4.0 Released

Published Mar 02, 2012

PHP 5.4.0 is released by the PHP development team with a large number of new features and bug fixes today.

New features of PHP 5.4.0

Removal of deprecated features

Backward incompatible changes

Deprecated features in PHP 5.4

New functions in PHP 5.4


First of all, it looks like a multiple inheritance like some of the other languages. Methods and properties from the Traits are being ‘merged’ into the class so you can’t have same name or will cause a fatal error. Take a look at the Conflict Resolution section in Traits on how to resolve this issue with the insteadof operator.

trait Hello {
    public function sayHello() {
        echo 'Hello ';

trait World {
    public function sayWorld() {
        echo ' World';

class MyHelloWorld {
    use Hello, World;
    public function sayExclamationMark() {
        echo '!';

$o = new MyHelloWorld();

The above example will output:

Hello World!

Short Array Syntax

You can now replace array() with just [].

$arrTest1 = [1, 2, 3, 4];

$arrTest2 = ['a' => 'one', 'b' => 'two', 'c' => 'three', 'd' => 'four'];

Built-in Web Server

The CLI SAPI provides a built-in web server, mainly for development and testing purposes.

Kindly visit Built-in webserver for more information.


If you are interested in the full list of changes, kindly visit the ChangeLog in PHP site.