3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace { function foo($n) { return $n; } } namespace A { use function foo; function foo($n) { return foo(2*$n); } namespace A { var_dump(foo(1)); }
Output for 7.0.0
Parse error: syntax error, unexpected end of file in /in/n18Ea on line 18
Process exited with code 255.
Output for 5.6.8 - 5.6.16
Fatal error: Namespace declarations cannot be nested in /in/n18Ea on line 16
Process exited with code 255.
Output for 5.5.24 - 5.5.30
Parse error: syntax error, unexpected 'function' (T_FUNCTION), expecting identifier (T_STRING) or \\ (T_NS_SEPARATOR) in /in/n18Ea on line 10
Process exited with code 255.

preferences:
165.98 ms | 1395 KiB | 24 Q