Inheritance in PHP: An extended class is
always dependent on a single base class, that is, multiple inheritance is
not supported. Classes are extended using the keyword 'extends'.
Code
<?php // extends is inheritance class A { function example($test) { echo "I am the original function A::example($test).<br />\n"; } }
class B extends A { function example($scale) { echo "I am the redefined function B::example($scale).<br />\n"; A::example(10); } }
// create an object of class A A::example(20); $a = new A(); $a->example(50); //this will print I am the original function A::example(50). // create an object of class B. $b = new B(30); // this will print // I am the redefined function B::example().<br /> // I am the original function A::example().<br /> $b->example(40);