可能重複:不存在的功能欄上
nested functions in php throws an exception when the outer is called more than once嵌套函數的怪事
爲什麼
function foo(){
function bar(){
}
}
bar();
返回致命錯誤
而
function foo(){
function bar(){
}
}
foo();
foo();
給bar()的重複聲明帶來致命錯誤?
確實將php函數作爲全局函數或父函數作用域來處理?
如你所說...全球! – 2012-08-15 19:53:49
請參閱PHP手冊,它非常好地解釋了這種情況。手冊頁在這裏:http://php.net/manual/functions.user-defined.php,見例3 *函數內的函數*。 - 這些函數在他們的例子中甚至有相同的名字! – hakre 2012-08-15 19:59:25
[RTFM](http://php.net/manual/en/functions.user-defined.php#example-147) – salathe 2012-08-15 20:05:03