<?php
class A{
function __call($name,$num){
echo "Method name:".$name."<p>";
echo "the number of parameter:".count($num)."<p>";
if(count($num)==1){
echo $this-> list1($a);
}
if(count($num)==2){
echo $this-> list2($a,$b);
}
}
public function list1($a){
return "this is function list1";
}
public function list2($a,$b){
return "this is function list1";
}
}
(new A)->listshow(1,2);
?>
(php overload) set two functions for the class member to choose. But have a mistake, it show that
Undefined variable: on line 10.
Why?