Correcting teacher:PHPz
Correction status:qualified
Teacher's comments:
//回调函数 //全局回调 function callB($name,$age){ echo 'name:'.$name; echo "<br/>"; echo "age:".$age; } $param = ['yyds','101']; call_user_func_array('callB',$param); echo "<br>"; //类静态回调 class A{ public function tes($name,$age){ echo 'name:'.$name."-age:".$age; } } call_user_func_array(['A','tes'],$param); echo "<br>"; //对象回调 class B{ public function tes($name,$age){ echo 'name:'.$name."-__age:".$age; } } call_user_func_array([new B(),'tes'],$param); echo "<br>"; //匿名回调 call_user_func_array(function ($a,$b){ echo 'name:'.$a."______age:".$b; },$param);
//递归函数 一个函数在它的函数体内调用它自身称为递归调用。这种函数称为递归函数 echo "<br>"; function jc($num){ if($num == 1){ return 1; }else{ return $num*jc($num - 1); } } echo '16 的阶乘是:'.jc(16);