3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace { function foo() { var_dump(__FUNCTION__); } } namespace Bar { function defineFoo() { function foo() { var_dump(__FUNCTION__); } } foo(); defineFoo(); foo(); }
Output for 7.3.0 - 7.3.30, 7.4.0 - 7.4.23, 8.0.0 - 8.0.10, 8.1rc1
string(3) "foo" string(7) "Bar\foo"

preferences:
171.48 ms | 531 KiB | 14 Q