3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php $makefoo = true; /* 我们不能在处调用foo()函数, 因为它还不存在,但可以调用bar()函数。*/ bar(); if ($makefoo) { function foo() { echo "I don't exist until program execution reaches me.\n"; } } /* 现在我们可以安全调用函数 foo()了, 因为 $makefoo 值为真 */ if ($makefoo) foo(); function bar() { echo "I exist immediately upon program start.\n"; } ?>
Output for 4.3.0 - 7.1.0
I exist immediately upon program start. I don't exist until program execution reaches me.