3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php function unset_globals($array) { if(!is_array($array)) { return; } foreach(array_keys($array) as $key) { unset($GLOBALS[$key]); unset($GLOBALS[$key]); // Double unset to circumvent the zend_hash_del_key_or_index hole in PHP <4.4.3 and <5.1.4 } } $ryat = 'haha'; //var_dump($GLOBALS); $_GET['GLOBALS'] = 'hi'; $_GET['ryat'] = 'hi'; unset_globals($_GET); var_dump($GLOBALS); echo $ryat;
Output for 5.0.4 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined variable: GLOBALS in /in/HE4sq on line 12 Notice: Undefined variable: GLOBALS in /in/HE4sq on line 11 Notice: Undefined variable: GLOBALS in /in/HE4sq on line 12 Notice: Undefined variable: GLOBALS in /in/HE4sq on line 20 NULL haha
Output for hhvm-3.12.0
NULL Notice: Undefined variable: ryat in /in/HE4sq on line 21
Output for hhvm-3.10.0

Process exited with code 153.
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: GLOBALS in /in/HE4sq on line 12 Notice: Undefined variable: GLOBALS in /in/HE4sq on line 11 Notice: Undefined variable: GLOBALS in /in/HE4sq on line 12 Notice: Undefined variable: GLOBALS in /in/HE4sq on line 20 NULL haha
Output for 4.3.0 - 4.4.9
Notice: Undefined variable: GLOBALS in /in/HE4sq on line 20 NULL Notice: Undefined variable: ryat in /in/HE4sq on line 21