在JavaScript中,嵌套函数非常有用:闭包,私有方法以及您拥有的东西。什么是嵌套PHP函数?有人使用它们吗?这是我做的小调查<?phpfunction 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: test2inner( 'test3' ); // inner: test3outer( 'test4' ); // Fatal error: Cannot redeclare inner()
添加回答
举报
0/150
提交
取消