3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test1() { // We have to check for existance because each call will try to define the function globally like including a file would. if (!function_exists('test2')) { function test2() { echo 'there' . PHP_EOL; } } echo 'here' . PHP_EOL; } echo "The internal method isn't defined yet: "; var_dump(function_exists('test2')); test1(); echo "Woops, function definitions don't get scoped by the function that define them. That's a feature but now we accidentally have a global function we might not have intended!: "; var_dump(function_exists('test2')); test2();

preferences:
22.17 ms | 406 KiB | 5 Q