3v4l.org

run code in 300+ PHP versions simultaneously
<?php $_GET['GLOBALS'] = ; $_GET['hi'] = $hi = 1; deregister_globals(); var_dump($hi); function deregister_globals() { $not_unset = array( 'GLOBALS' => true, '_GET' => true, '_POST' => true, '_COOKIE' => true, '_REQUEST' => true, '_SERVER' => true, '_SESSION' => true, '_ENV' => true, '_FILES' => true, 'phpEx' => true, 'phpbb_root_path' => true ); // Not only will array_merge and array_keys give a warning if // a parameter is not an array, array_merge will actually fail. // So we check if _SESSION has been initialised. if (!isset($_SESSION) || !is_array($_SESSION)) { $_SESSION = array(); } // Merge all into one extremely huge array; unset this later $input = array_merge( array_keys($_GET), array_keys($_POST), array_keys($_COOKIE), array_keys($_SERVER), array_keys($_SESSION), array_keys($_ENV), array_keys($_FILES) ); foreach ($input as $varname) { if (isset($not_unset[$varname])) { // Hacking attempt. No point in continuing. if (isset($_COOKIE[$varname])) { echo "Clear your cookies. "; } echo "Malicious variable name detected. Contact the administrator and ask them to disable register_globals."; exit; } unset($GLOBALS[$varname]); } unset($input); }
Output for 4.4.2 - 4.4.9, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.29, 5.4.0 - 5.4.35
Parse error: syntax error, unexpected ';' in /in/6U3fn on line 3
Process exited with code 255.
Output for 4.3.0 - 4.3.1, 4.3.5 - 4.3.11, 4.4.0 - 4.4.1, 5.0.0 - 5.0.5
Parse error: parse error, unexpected ';' in /in/6U3fn on line 3
Process exited with code 255.
Output for 4.3.2 - 4.3.4
Parse error: parse error in /in/6U3fn on line 3
Process exited with code 255.

preferences:
220.46 ms | 1395 KiB | 125 Q