3v4l.org

run code in 300+ PHP versions simultaneously
<?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'; $_GET['_COOKIE'] = 'hi'; //var_dump($GLOBALS); unset_globals($_GET); var_dump($GLOBALS); echo $ryat; var_dump($_COOKIE);

preferences:
52.34 ms | 402 KiB | 5 Q