Code

<?php
class base
{
public function base()
{
echo "<br/><font style='font-size:20px; color:red;'>
base class constructor</font>";
}
public function methodA1($data1)
{
echo "<br/>This is base class methodA() ";
echo "<font style='font-size:24px; color:Green;'>".gettype($data1)."</font>";
}
}
// inherting a calss with extend word
class derived extends base
{
//overriding methodA()
public function methodA1($data1)
{
echo "<br/>Class derived methodA is overloaded :";
echo "<font style='font-size:24px; color:Green;'>".gettype(
$data1)."</font>";
}
}
// testing base class directly
$dr1 = new base();
$dr1->methodA1("Hello");
//testing derived class
$dr = new derived();
$dr->methodA1(1234);
?>