3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?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)); }
based on 6s62o
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.4.10 - 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.
Output for 5.3.20 - 5.3.29
Parse error: syntax error, unexpected T_FUNCTION, expecting T_STRING or T_NS_SEPARATOR in /in/n18Ea on line 10
Process exited with code 255.