我试图想象 javascript 和 php 如何处理嵌套函数。重点是:php :b(); //CANNOT call b at this point because isn't defined yeta(); //CAN call a at this point because the interpreter see the declarb(); //ok now i can call b, because the interpreter see the declaration after a executionfunction a(){ function b(){ echo "inner"; }}同时在javascript 中:b(); //CANNOT call b isn't defined yeta(); //CAN call a at this point because the interpreter see the declarfunction a(){ function b(){ console.log("inner"); }}a(); //ok now i can call a because is definedb(); // **CANNOT** call b yet !! 为什么在 javascript 中即使 a 被执行我也不能调用 b() ?PHP 在哪些方面表现不同?
添加回答
举报
0/150
提交
取消