Source Code:
(back to article)
<?php trait TraitA { public function methodA() { echo "Method A"; } } trait TraitB { public function methodB() { echo "Method B"; } } class MyClass { use TraitA, TraitB; } $obj = new MyClass(); $obj->methodA(); // Outputs: Method A $obj->methodB(); // Outputs: Method B
Result:
Report an issue