PHP Interview Questions
Does PHP support multiple inheritances?
PHP does not support multiple inheritances. To implement the features of multiple inheritances, the interface is used in PHP.
 
Example :
 
Here, two interfaces, Isbn and Type are declared and implemented in a class, book details to add the feature of multiple inheritances in PHP.
 
interface Isbn { 
public function setISBN($isbn);
}
interface Type{
public function setType($type); 
}
class bookDetails implements Isbn, Type {
private $isbn; 
private $type; 
public function setISBN($isbn)
{ 
$this -> isbn = $isbn; 
}
public function setType($type)
{ 
$this -> type = $type; 
}
}