Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.



Get Started Now!

Inheritance in PHP(OOPS Concept)

Inheritance :- When a class derives from another class. The child class will inherit all the public and protected properties and methods from the parent. An inherited class is defined by using the extends keyword.

There are three type of Inheritance:

  1. Single inheritance

Single inheritance supports php. In a single class can be derived by one class unique. We require to have two classes in between this method. One is the parent class and the other a child class itself.

2. Multilevel inheritance 

In this type of inheritance, there will be more than 2 classes involved. In Multilevel inheritance Parent class will be inherited by a child and then further child class will be inherited by another child class.

3. Hierarchical inheritance

When more than one class inherit to a single class. This type of inheritance known as Hierarchical Inheritance

SINGLE INHERITANCE

Ex:-

https://gist.github.com/AvinashKumar33/745e6e3769016a43ac7072b64dd388c0

Output:-

Multilevel inheritance 

Ex:-

https://gist.github.com/AvinashKumar33/fdabd7b9d34f2d367c48d3fbb2ea72c8

Output:-

Hierarchical inheritance

Ex:-

https://gist.github.com/AvinashKumar33/fd56b51f174a149e18067a62f9318b52

Output:-

Related Posts

How to Debug Apache Errors Using Log Files in XAMPP (Linux)

When working with web servers like Apache, errors can sometimes be tricky to figure out. Fortunately, Apache provides detailed log files that can help you identify what’s…

How to Resolve Laravel Dusk Installation Issues: Missing ext-zip and PHP Compatibility

Laravel Dusk is a powerful browser automation and testing tool that allows you to test the front-end of your Laravel application in real-time. However, if you’re encountering…

Testing the Capabilities of Your Laravel Application: Tools and Software to Use

As a developer working with Laravel, ensuring that your application performs efficiently, scales well, and provides a seamless experience for users is crucial. Whether you’re building a…

Implementing Retry Logic with Exponential Backoff

In modern web applications, API calls and network requests play a crucial role in retrieving data or interacting with external services. However, one common challenge developers face…

How to Resolve the “429 Too Many Requests” Error

The 429 Too Many Requests error occurs when a server is overwhelmed by too many requests in a short period. It’s a common issue when interacting with…

Best Tech websites in the world in 2025

AIOps School AIOps School is a learning platform focused on AI-powered IT operations (AIOps) and Machine Learning Ops (MLOps). Branded as the “Gateway to AI-Powered IT &…

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x