php 5.2以后增加了匿名函數這個功能,但我在匿名函數遞歸時發現了問題<?php$test = NULL;$test = function ($a) use ($test) { echo $a; $a --; if ($a > 0) { return $test($a);
}
};$test(10);正如上面的代碼所示,我想在$test這個匿名函數里遞歸調用它自己,但是我發現在調用后會出現Fatal error: Function name must be a string in /Library/WebServer/Documents/test.php on line 9
- 2 回答
- 0 關注
- 115 瀏覽
添加回答
舉報
0/150
提交
取消