New Features in php 5.4

Features of PHP 5.4 are given below:

Traits are the most famous innovation in PHP 5.4: they consist in code fragments (a set of methods) that can be reused horizontally across classes.
Moreover, traits have a conflict resolution mechanism: multiple traits can be used in the same class even if some method names are overlapping.

Arrays improvements: syntax and dereferencing

class A
    public function foo()
      return new B();

class B
    public function bar()
      return "Hi";
$a = new A();
echo $a->foo()->bar(); // Will output Hi

Added indirect method call through array
Now an array(‘class’, ‘method’) can be used to call a function. is_callable will return true.

class Foo {
   public function bar($name) {
      echo "Hi, $name";
$f = array('Foo','bar');
echo $f('chandan'); // Hi, chandan

Built-in HTTP server
As of PHP 5.4.0, the CLI SAPI provides a built-in web server.
This web server is designed for developmental purposes only, and should not be used in production.

PHP is being modernized by taking away (with backwards incompatibility) some old features which promote spaghetti code, and including new constraints.

  • Magic quotes options have been dropped.
  • The PHP namespace is now reserved for native code.
  • E_STRICT errors, covering for example correct usage of object-oriented constructs and deprecation warnings, are now covered by E_ALL. error_reporting(E_ALL) will show you really every error, warning and notice.

Upload progress

<form action=”upload.php” method=”POST” enctype=”multipart/form-data”>

<input type=”hidden” name=”” value=”testupload” />

<input type=”file” name=”file1″ />

<input type=”file” name=”file2″ />

<input type=”submit” />


which allows you to poll the server multiple times and get back info about the progress (in this case from $_SESSION[“upload_progress_ testupload “]).

Option to disable POST data processing
The ability to disable POST data processing to save memory and CPU cycles – in case it is activated, raw data can still be read through the php://input stream.

Share and Enjoy

  • Facebook
  • Twitter
  • Google Plus
  • Live
  • Delicious
  • Digg
  • StumbleUpon
  • Add to favorites
  • Email
  • RSS
  • Instapaper
  • FriendFeed


  1. hi to all codinghint.comers this is my first post and thought i would say hello to you all –
    thank yous speak soon

  2. Great Content…

    we like to honor many other internet sites on the web, even if they aren’t linked to us, by linking to them. Under are some webpages worth checking out…

  3. Outstanding post, you have pointed out some superb points, I likewise think this is a very fantastic website.