3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php namespace Foo { use function strlen; function strlen(string $str) : string { return strlen($str) + 1; } } namespace Foo { var_dump(strlen("abc")); }
based on aTUMA
Output for 7.0.20 - 7.3.1
Fatal error: Cannot declare function Foo\strlen because the name is already in use in /in/g7spn on line 4
Process exited with code 255.
Output for 7.0.0 - 7.0.6
string(1) "4"
Output for 5.6.8 - 5.6.28
Parse error: syntax error, unexpected ':', expecting '{' in /in/g7spn on line 4
Process exited with code 255.
Output for 5.4.10 - 5.5.35
Parse error: syntax error, unexpected 'function' (T_FUNCTION), expecting identifier (T_STRING) or \\ (T_NS_SEPARATOR) in /in/g7spn on line 3
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/g7spn on line 3
Process exited with code 255.