InterviewSolution
Saved Bookmarks
| 1. |
What is traits? How it is used in php? |
|
Answer» TRAITS is a group of methods that reuse in single inheritance. A TRAIT is INTENDED to reduce some limitations of single inheritance by enabling a developer to reuse sets of methods. Exampletrait HelloWorld { } class MyWorld { use HelloWorld; } $world = new MyWorld(); echo $world->sayHello() . " " . $world->sayWorld(); //Hello World |
|