I have 3 classes (3 files):
a.class.php
b.class.php
c.class.php
I want to extend class a and b in the class c (file 3):
How I could do that? I want to use both class functions of a + b in my new class C
I have 3 classes (3 files):
a.class.php
b.class.php
c.class.php
I want to extend class a and b in the class c (file 3):
How I could do that? I want to use both class functions of a + b in my new class C
You are asking for multiple inheritance, which is not supported by php. You should have a look at composition instead.
There is no multiple inheritance in PHP. So you can't do that.
Try using composition and re-arranging your class structure.
class a
class b extends a
class c extends b
done.
There is a way of achieving this in PHP using mixins. See this http://www.phpdeveloper.org/news/6139 for example. However I would probably try to find a different way of designing your code so you don't have to use it.
Otherwise PHP 5.4 will bring Traits which will natively support what you want: http://simas.posterous.com/new-to-php-54-traits
Class c extends a implements interface
Done