0

I know, we do not have concept of multiple inheritance in php. so is there any alternative ?

example: class1 is combination of class2 and class3

i cannot use

 class1 extends class2,class3

so how should i use ?

 class2 extends class3;
 class1 extends class2;

not sure so asking for help ?

J.K
  • 1,382
  • 1
  • 11
  • 27
  • Depends on what you're trying to achieve. A different inheritance hierarchy may be the answer, yes. Or maybe traits. Or maybe composition. There's no *general* answer. – deceze May 09 '14 at 09:25
  • Check traits: http://www.phpro.org/tutorials/Simulating-Multiple-Inheritance-With-PHP-Traits.html – Sal00m May 09 '14 at 09:27
  • If you are using php 5.4+ try to read http://www.php.net/manual/en/language.oop5.traits.php – chicharito May 09 '14 at 09:25

0 Answers0