<?php
class Overload{
const pi = 3.141432;
public function __call($methodName , $arguments){
switch(count($arguments)){
case 0 :
return 0;
case 1 :
return $arguments[0] * self::pi;
case 2 :
return $arguments[0] * $arguments[1] * self::pi;
}
}
}
$overObj = new Overload();
echo $overObj->area(). "\n"; // returns 0
echo $overObj->area(1) . "\n"; // returns 3.141432
echo $overObj->area(1,2)."\n"; // returns 6.282864
?>
To embed this program on your website, copy the following code and paste it into your website's HTML: