Code
<?php
class base
{
public function base()
{
echo "<br/><font style='font-size:20px; color:red;'>
base class constructor</font>";
}
public function methodA() {
echo "<br/>This is base class methodA()";
}
}
// inheriting a class with extend word
class derived extends base
{
//overriding methodA()
public function methodA()
{
echo "<br/>Class derived methodA is overridden";
}
}
// testing base class directly
$dr1 = new base();
$dr1->methodA();
//testing derived class
$dr = new derived();
$dr->methodA();
?>

Run Time Views
