<?php
$a ;
$z;
$pi=3.14;
$r;
$s;
$w;
$l;
$res;
interface i1
{
public function area();
}
class square implements i1
{
public function __construct($n)
{
//$GLOBALS['b'] =
$GLOBALS['a']=$n;
}
public function area ()
{
$GLOBALS['z']=$GLOBALS['a'] * $GLOBALS['a'];
echo "
area of square is:" .$GLOBALS['z'];
}
}
class circle implements i1
{
public function __construct($n)
{
//$GLOBALS['b'] =
$GLOBALS['r']=$n
}
public function area ()
{
$GLOBALS['s']=$GLOBALS['pi']* $GLOBALS['r'];
echo "
area of circle is:" .$GLOBALS['s'];
}
}
class ractangle implements i1
{
public function __construct($a,$b)
{
//$GLOBALS['b'] =
$GLOBALS['w']=$a;
$GLOBALS['l']=$b;
}
public function area ()
{
$GLOBALS['res']=$GLOBALS['w']* $GLOBALS['l'];
echo "
area of circle is:" .$GLOBALS['res'];
}
}
$obj=new square(10);
$obj->area();
$obj=new circle(2);
$obj->area();
$obj=new ractangle(2,3);
$obj->area();
?>