PHP 5.4 introduces the concept of traits. In PHP 5.4 version several new features was introduced, one such feature was PHP traits.
PHP traits help us to minimize code duplication in our codebase. Until the concept of traits, PHP uses classical inheritance model in which one class can inherit only one class. But sometimes, it is beneficial to inherit from multiple classes to avoid code duplication. To solve this problem, PHP community introduces the concept of traits.
Starting from PHP 5.4 , PHP incorporates a feature of a built-in web server. You can take the advantage of PHP built-in web server for development and testing of your PHP applications. It means you don’t need to configure Apache virtual host to run your PHP applications.
In my previous post i have discussed new features of PHP 5.4 such as concept of Traits and shorter syntax of array.
In this post i’ll discuss the concept of function array dereferencing which is introduced in PHP 5.4. In simple words function array dereference means when array is returned, pick the value directly from it.
With every release of PHP new version, new functionality,improvement and bug fixes are released. PHP 5.4 introduces the concept of Generators and traits etc. Apart from new functionality, PHP 5.4 introduces many improvements one such improvement is shorter syntax of array declaration.