This subject New Features in PHP 5.4 is not new as PHP 5.4 was released on March 1, 2012, But many of us still do not know what are the New features in php 5.4, So lets get familiar with them .
Why should I upgrade to 5.4 ? So What’s new Features in PHP 5.4 ?
So before going any further i will give you a very obvious reason of them all which is performance and security 🙂
What are Trait in PHP ? Why do we need Trait in PHP ?
In this article we will be working on a very new feature which is introduced in PHP 5.4 which is Traits in PHP.
Traits are mechanisms which help and increase in code re-usability, and also serves perfectly to solve the problem of multiple inheritance in php.
For example we have two or more than two classes that need to access a method / function .
So to solve this before version 5.4 you were suppose to do something like :