?php class Country {var $NAME; var $TLD; function Country($name, $tld) {$this - NAME = $name; $this - TLD = $tld;} function print_info($prestr="") {echo $prestr ."Country: ".$this - NAME ."\n"; echo $prestr ."Top Level Domain: ".$this - TLD ."\n";}} $cntry = new Country("Peru" ,"pe"); echo "* Calling the object method directly\n"; $cntry - print_info(); echo "\n* Calling the same method indirectly\n"; call_user_method ("print_info", $cntry, "\t");?
call_user_func() 함수를 참고하세요.