I have tried to extend the two class with the same instance.it's not working..is there any way to do it..?
class Watermark extends PDF_Rotate, MyPDF{
//Your Code
}
I have tried to extend the two class with the same instance.it's not working..is there any way to do it..?
class Watermark extends PDF_Rotate, MyPDF{
//Your Code
}
No, you can not extend two or more classes but you can implement more than one interface in php. Like below
<?php
class SomeClass extends HelloDolly implements HelloInterface, DollyInterface {
// do your stuff
}
You can extend only one parent in your class. From PHP Doc:
A class can inherit the methods and properties of another class by using the keyword extends in the class declaration. It is not possible to extend multiple classes; a class can only inherit from one base class.
But you can use for example many interfaces or traits in one class definition. From PHP Doc:
Classes may implement more than one interface if desired by separating each interface with a comma.