callfunc函数,及函数传值
<?php function foo() { echo "\nfoot()"; } function callfunc($x, $y='') { if($y == '') { if($x == ''){ echo "\nempty"; }else{ $x(); } }else{ $y->$x(); } } class cbar { public function fcatch() { echo "\nfcatch"; } } $x = ''; callfunc($x); //empty $x = "foo"; callfunc($x); //调用foot()这个函数 $o = new cbar(); $x = 'fcatch'; callfunc($x, $o); //fcatch ?>