Multilevel and Multiple inheritances in PHP
PHP does not support multiple inheritance. PHP supports multileve inheritance. Child class class can’t inherit by more than one parent class. But Parent class inherit the properties of prand parend class and grand child can inherit the properties of parent class.
Multiple inheritance in PHP
1 2 3 4 5 6 7 8 9 10 11 12 |
class class { // body } class class1 { // body } class class3 extends class class1 { // body } |
This code will not work in php because PHP does not support multiple Inheritance.
Multilevel inheritance in PHP
1 2 3 4 5 6 7 8 9 10 11 12 |
class class 1 { // body } class class2 extends class1 { // body } class class3 extends class2 { // boddy } |
In the given example class2 inheriting the class1 and class3 inheriting the class2. So class3 have some properties of class2 and some properties of class1.