PHPGurukul

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

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

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.

Anuj Kumar

This is Anuj Kumar. I’m a professional web developer with 4+ year experience. I write blogs in my free time. I love to learn new technologies and share with others.
I founded PHPGurukul in September 2015. The main aim of this website to provide PHP, Jquery, MySQL, PHP Oops and other web development tutorials.
.

Recommended Tutorials for you


4 comments

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Follow us

Don't be shy, get in touch. We love meeting interesting people and making new friends.