3v4l.org

run code in 300+ PHP versions simultaneously
<?php namespace Foo { use function random_int; var_dump(random_int(1, 100)); var_dump(\random_int(1, 100)); function random_int(int $min, int $max) : int { return 4; } }
Output for 7.0.20, 7.1.0 - 7.1.7, 7.2.0
Fatal error: Cannot declare function Foo\random_int because the name is already in use in /in/aTUMA on line 7
Process exited with code 255.
Output for 7.0.6
int(97) int(55)
Output for 7.0.5
int(56) int(68)
Output for 7.0.4
int(70) int(17)
Output for 7.0.3
int(83) int(45)
Output for 7.0.2
int(38) int(83)
Output for 7.0.1
int(16) int(37)
Output for 7.0.0
int(26) int(6)
Output for 5.6.8 - 5.6.21
Parse error: syntax error, unexpected ':', expecting '{' in /in/aTUMA on line 7
Process exited with code 255.
Output for 5.5.24 - 5.5.35
Parse error: syntax error, unexpected 'function' (T_FUNCTION), expecting identifier (T_STRING) or \\ (T_NS_SEPARATOR) in /in/aTUMA on line 3
Process exited with code 255.

preferences:
73.7 ms | 401 KiB | 44 Q