I searched a lot on internet but I didn't find a proper answer. Sound like traits and inheritance have same work. how traits are different from inheritance and use of traits.
Asked
Active
Viewed 1,097 times
-1
-
2The [PHP manual](https://secure.php.net/manual/en/language.oop5.traits.php) has a whole page about traits – brombeer Feb 25 '18 at 07:34
-
https://stackoverflow.com/questions/9205083/traits-vs-interfaces – Ahmad Mobaraki Feb 25 '18 at 07:45
1 Answers
2
A Trait is intended to reduce some limitations of single inheritance by enabling a developer to reuse sets of methods freely in several independent classes living in different class hierarchies. The semantics of the combination of Traits and classes is defined in a way which reduces complexity, and avoids the typical problems associated with multiple inheritance and Mixins.

Mike Stratton
- 463
- 1
- 7
- 20