I am using the overloading in PHP, whats the problem with my PHP code even its only 8 lines of code:
class c1{
public function __call($name,$array){
if($this->$name()){ return true;}
}
}
$cl = new c1;
echo $cl->m1();
and it says:
"Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 262144 bytes)"
m1()
,__call()
is invoked and tries to callm1()
__call()
is invoked and tries to callm1()
etc... Endless loop. At least endless until memory is exhausted. – AbraCadaverif(method_exists($this, $name)){ return true;}
– AbraCadaver