最佳答案
                                        
                                                                        
                                在 JavaScript 中,嵌套函数非常有用: 闭包、私有方法以及其他... ..。
嵌套 PHP 函数是用来做什么的? 有人使用它们吗? 用来做什么?
这是我做的一个小调查
<?php
function outer( $msg ) {
function inner( $msg ) {
echo 'inner: '.$msg.' ';
}
echo 'outer: '.$msg.' ';
inner( $msg );
}
inner( 'test1' );  // Fatal error:  Call to undefined function inner()
outer( 'test2' );  // outer: test2 inner: test2
inner( 'test3' );  // inner: test3
outer( 'test4' );  // Fatal error:  Cannot redeclare inner()