3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function main() { $g = $GLOBALS; foreach (array_keys($GLOBALS) as $k) { unset($GLOBALS[$k]); } var_dump($g); var_dump((bool)$g); } main();
based on FKDLh
Output for 4.3.0 - 4.4.9, 5.4.0 - 5.6.28, hhvm-3.10.0 - 3.13.2, 7.0.0 - 7.1.0
array(0) { } bool(false)
Output for 5.2.3 - 5.3.29
Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 array(15) { ["_ENV"]=> array(9) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" } ["HTTP_ENV_VARS"]=> array(9) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" } ["argv"]=> array(1) { [0]=> string(9) "/in/nWRdU" } ["argc"]=> int(1) ["_POST"]=> array(0) { } ["HTTP_POST_VARS"]=> array(0) { } ["_GET"]=> array(0) { } ["HTTP_GET_VARS"]=> array(0) { } ["_COOKIE"]=> array(0) { } ["HTTP_COOKIE_VARS"]=> array(0) { } ["_SERVER"]=> array(17) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" ["PHP_SELF"]=> string(9) "/in/nWRdU" ["SCRIPT_NAME"]=> string(9) "/in/nWRdU" ["SCRIPT_FILENAME"]=> string(9) "/in/nWRdU" ["PATH_TRANSLATED"]=> string(9) "/in/nWRdU" ["DOCUMENT_ROOT"]=> string(0) "" ["REQUEST_TIME"]=> int(1411750925) ["argv"]=> array(1) { [0]=> string(9) "/in/nWRdU" } ["argc"]=> int(1) } ["HTTP_SERVER_VARS"]=> array(17) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" ["PHP_SELF"]=> string(9) "/in/nWRdU" ["SCRIPT_NAME"]=> string(9) "/in/nWRdU" ["SCRIPT_FILENAME"]=> string(9) "/in/nWRdU" ["PATH_TRANSLATED"]=> string(9) "/in/nWRdU" ["DOCUMENT_ROOT"]=> string(0) "" ["REQUEST_TIME"]=> int(1411750925) ["argv"]=> array(1) { [0]=> string(9) "/in/nWRdU" } ["argc"]=> int(1) } ["_FILES"]=> array(0) { } ["HTTP_POST_FILES"]=> array(0) { } ["_REQUEST"]=> array(0) { } } bool(true)
Output for 5.1.0 - 5.2.2
Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 array(15) { ["_ENV"]=> array(9) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" } ["HTTP_ENV_VARS"]=> array(9) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" } ["argv"]=> array(1) { [0]=> string(9) "/in/nWRdU" } ["argc"]=> int(1) ["_POST"]=> array(0) { } ["HTTP_POST_VARS"]=> array(0) { } ["_GET"]=> array(0) { } ["HTTP_GET_VARS"]=> array(0) { } ["_COOKIE"]=> array(0) { } ["HTTP_COOKIE_VARS"]=> array(0) { } ["_SERVER"]=> array(13) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" ["PHP_SELF"]=> string(0) "" ["REQUEST_TIME"]=> int(1411750925) ["argv"]=> array(1) { [0]=> string(9) "/in/nWRdU" } ["argc"]=> int(1) } ["HTTP_SERVER_VARS"]=> array(13) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" ["PHP_SELF"]=> string(0) "" ["REQUEST_TIME"]=> int(1411750925) ["argv"]=> array(1) { [0]=> string(9) "/in/nWRdU" } ["argc"]=> int(1) } ["_FILES"]=> array(0) { } ["HTTP_POST_FILES"]=> array(0) { } ["_REQUEST"]=> array(0) { } } bool(true)
Output for 5.0.4 - 5.0.5
Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 array(15) { ["_ENV"]=> array(9) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" } ["HTTP_ENV_VARS"]=> array(9) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" } ["argv"]=> array(1) { [0]=> string(9) "/in/nWRdU" } ["argc"]=> int(1) ["_POST"]=> array(0) { } ["HTTP_POST_VARS"]=> array(0) { } ["_GET"]=> array(0) { } ["HTTP_GET_VARS"]=> array(0) { } ["_COOKIE"]=> array(0) { } ["HTTP_COOKIE_VARS"]=> array(0) { } ["_SERVER"]=> array(12) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" ["PHP_SELF"]=> string(0) "" ["argv"]=> array(1) { [0]=> string(9) "/in/nWRdU" } ["argc"]=> int(1) } ["HTTP_SERVER_VARS"]=> array(12) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" ["PHP_SELF"]=> string(0) "" ["argv"]=> array(1) { [0]=> string(9) "/in/nWRdU" } ["argc"]=> int(1) } ["_FILES"]=> array(0) { } ["HTTP_POST_FILES"]=> array(0) { } ["_REQUEST"]=> array(0) { } } bool(true)
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 Notice: Undefined variable: GLOBALS in /in/nWRdU on line 6 array(15) { ["_ENV"]=> array(9) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" } ["HTTP_ENV_VARS"]=> array(9) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" } ["argv"]=> array(1) { [0]=> string(9) "/in/nWRdU" } ["argc"]=> int(1) ["_POST"]=> array(0) { } ["HTTP_POST_VARS"]=> array(0) { } ["_GET"]=> array(0) { } ["HTTP_GET_VARS"]=> array(0) { } ["_COOKIE"]=> array(0) { } ["HTTP_COOKIE_VARS"]=> array(0) { } ["_SERVER"]=> array(12) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" ["PHP_SELF"]=> string(0) "" ["argv"]=> array(1) { [0]=> string(9) "/in/nWRdU" } ["argc"]=> int(1) } ["HTTP_SERVER_VARS"]=> array(12) { ["TERM"]=> string(5) "xterm" ["PATH"]=> string(13) "/usr/bin:/bin" ["LANG"]=> string(1) "C" ["SHELL"]=> string(7) "/bin/sh" ["MAIN"]=> string(16) "/var/mail/nobody" ["LOGNAME"]=> string(6) "nobody" ["USER"]=> string(6) "nobody" ["USERNAME"]=> string(6) "nobody" ["HOME"]=> string(1) "/" ["PHP_SELF"]=> string(0) "" ["argv"]=> array(1) { [0]=> string(9) "/in/nWRdU" } ["argc"]=> int(1) } ["_FILES"]=> array(0) { } ["HTTP_POST_FILES"]=> array(0) { } ["_REQUEST"]=> array(0) { } } bool(true)