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'; $_GET['GLOBALS'] = 'hi'; $_GET['ryat'] = 'hi'; unset_globals($_GET); echo $ryat;
Output for 5.0.4 - 5.6.28, 7.0.0 - 7.1.0
Notice: Undefined variable: GLOBALS in /in/CvaRv on line 12 Notice: Undefined variable: GLOBALS in /in/CvaRv on line 11 Notice: Undefined variable: GLOBALS in /in/CvaRv on line 12 haha
Output for hhvm-3.10.0 - 3.12.0
Notice: Undefined variable: ryat in /in/CvaRv on line 19
Output for 5.0.0 - 5.0.3
Notice: Undefined variable: GLOBALS in /in/CvaRv on line 12 Notice: Undefined variable: GLOBALS in /in/CvaRv on line 11 Notice: Undefined variable: GLOBALS in /in/CvaRv on line 12 haha
Output for 4.3.0 - 4.4.9
Notice: Undefined variable: ryat in /in/CvaRv on line 19