【請教】在函數(shù)里面定義函數(shù)后,調(diào)用,為什么會報錯?
<?php function?test5(){ ????function?test6(){ ????????echo?'this?is?test6'; ????????return?888; ????} ????echo?123; ????return?test6(); } test5(); echo?'<hr?/>'; var_dump(test5());
上面這段代碼報錯:
?Fatal error: Cannot redeclare test6() (previously declared in E:\xampp\htdocs\test\testecho.php:4) in E:\xampp\htdocs\test\testecho.php on line?4
2017-03-26
重復(fù)定義了test6函數(shù)了
把var_dump(test5())去掉即可
調(diào)用了test5后 可以直接調(diào)用test6
2017-10-21
函數(shù)不能嵌套
2017-07-24
不太清楚