News Feed
Sections




News Archive
Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

Refulz Blog:
Traits in PHP 5.4 - Why we need Traits
March 30, 2012 @ 11:53:35

On the Refulz blog today there's a new post about traits in PHP (recently introduced in PHP 5.,4) and why we need them in our development.

Traits is one major addition to PHP. We read an introductory article about Traits in PHP 5.4. In the post, we saw an example code which only resembles single inheritance. So, what is the actual purpose of Traits and why do we need to use Traits in our code.

They give a sample use case involving two types of clients, Business and Individual, and how you can use a single Client class and trait to provide address-related functionality.

0 comments voice your opinion now!
traits introduction example class tutorial


blog comments powered by Disqus

Similar Posts

Justin Silverton\'s Blog: How to Cache Smarty Templates (as per the manual)

ThinkPHP Blog: Methods to Reduce the Load of Your Webserver by Caching Content

DevShed: Developing a Form Validation System with the Observer Pattern in PHP

Three Devs & A Maybe Podcast: Introduction to the Standard PHP Library (SPL)

Dhiraj Patra's Blog: Caching PHP Programs with PEAR


Community Events

Don't see your event here?
Let us know!


application part2 conference voicesoftheelephpant introduction configure api php7 opinion language symfony2 performance example community framework series release interview podcast laravel

All content copyright, 2015 PHPDeveloper.org :: info@phpdeveloper.org - Powered by the Solar PHP Framework