Function Overriding in PHP

The function overriding is only pertinent to derived classes, where the parent class has defined a method and the derived class wishes to override that method. In this tutorial, We will explain about the function overriding in PHP.

Below is an example of function overriding in PHP. In the below example, we are overriding the myFoo() function to change the output of myFoo() function.

Liked this tutorial? Do Like & share with your friends 🙂

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.