PHP OOP: Traits

What is Traits?

  • Code is shortened by using Traits.
  • One code is used everywhere just by writing the trait function.

Example :

Output:

Multi traits use example:

Output:

Tagged : / / / / / / / / / / / / / /