3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
_GET _POST _COOKIE _FILES argv argc _SERVER GLOBALS <?php $_COOKIE['GLOBALS'] = 'print_r'; $_POST['print_r'] = 'GLOBALS'; $GLOBALS= $GLOBALS['next']= next($GLOBALS)[ $next['next']= next($GLOBALS)['GLOBALS'] ][ $next['GLOBALS']=next($GLOBALS)[$next['next']] ][ $next['GLOBALS']=next($next['GLOBALS']) ][ $next['next']($next['GLOBALS']) ] =next(neXt($next['next'])); foreach($GLOBALS as $var_name => $value) { echo $var_name; echo ' '; } ?>
based on PvE7Z
Output for 7.1.0
_GET _POST _COOKIE _FILES argv argc _SERVER GLOBALS Notice: Undefined index: print_r in /in/X1v9q on line 18 Warning: next() expects parameter 1 to be array, null given in /in/X1v9q on line 21 Warning: next() expects parameter 1 to be array, string given in /in/X1v9q on line 25 Notice: Only variables should be passed by reference in /in/X1v9q on line 25 Warning: next() expects parameter 1 to be array, null given in /in/X1v9q on line 25 Notice: String offset cast occurred in /in/X1v9q on line 18 Fatal error: Uncaught Error: Cannot use string offset as an array in /in/X1v9q:18 Stack trace: #0 {main} thrown in /in/X1v9q on line 18
Process exited with code 255.
Output for 7.0.0 - 7.0.14
_GET _POST _COOKIE _FILES argv argc _SERVER GLOBALS Notice: Undefined index: print_r in /in/X1v9q on line 18 Warning: next() expects parameter 1 to be array, null given in /in/X1v9q on line 21 Warning: next() expects parameter 1 to be array, string given in /in/X1v9q on line 25 Notice: Only variables should be passed by reference in /in/X1v9q on line 25 Warning: next() expects parameter 1 to be array, null given in /in/X1v9q on line 25 Notice: String offset cast occurred in /in/X1v9q on line 18 Fatal error: Uncaught Error: Cannot use string offset as an array in /in/X1v9q:21 Stack trace: #0 {main} thrown in /in/X1v9q on line 21
Process exited with code 255.
Output for hhvm-3.10.0 - 3.12.0
_GET _POST _COOKIE _FILES argv argc _SERVER GLOBALS Notice: Undefined index: print_r in /in/X1v9q on line 18 Warning: Invalid operand type was used: expecting an array in /in/X1v9q on line 21 Warning: Invalid operand type was used: expecting an array in /in/X1v9q on line 25 Warning: Invalid operand type was used: expecting an array in /in/X1v9q on line 25 Warning: Invalid argument supplied for foreach() in /in/X1v9q on line 31
Output for 5.4.5 - 5.6.28
_GET _POST _COOKIE _FILES argv argc _SERVER GLOBALS Notice: Undefined index: print_r in /in/X1v9q on line 18 Warning: next() expects parameter 1 to be array, null given in /in/X1v9q on line 21 Warning: next() expects parameter 1 to be array, string given in /in/X1v9q on line 25 Strict Standards: Only variables should be passed by reference in /in/X1v9q on line 25 Warning: next() expects parameter 1 to be array, null given in /in/X1v9q on line 25 Notice: String offset cast occurred in /in/X1v9q on line 20 Fatal error: Cannot use string offset as an array in /in/X1v9q on line 22
Process exited with code 255.
Output for 5.4.0 - 5.4.4
_GET _POST _COOKIE _FILES argv argc _SERVER GLOBALS Notice: Undefined index: print_r in /in/X1v9q on line 18 Warning: next() expects parameter 1 to be array, null given in /in/X1v9q on line 21 Warning: next() expects parameter 1 to be array, string given in /in/X1v9q on line 25 Strict Standards: Only variables should be passed by reference in /in/X1v9q on line 25 Warning: next() expects parameter 1 to be array, null given in /in/X1v9q on line 25 Notice: String offset cast occured in /in/X1v9q on line 20 Fatal error: Cannot use string offset as an array in /in/X1v9q on line 22
Process exited with code 255.
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.3.29
Parse error: syntax error, unexpected '[' in /in/X1v9q on line 11
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected '[' in /in/X1v9q on line 11
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/X1v9q on line 11
Process exited with code 255.