3v4l.org

run code in 300+ PHP versions simultaneously
<?php $a = 1; unset($a); $g = array_filter($GLOBALS, function($k) { return !in_array($k, ["g", "HTTP_RAW_POST_DATA", "GLOBALS", "_FILES", "_REQUEST", "_SESSION", "_ENV", "_SERVER", "_GET", "_POST", "_COOKIE", "argv", "argc"]); }, ARRAY_FILTER_USE_KEY); var_dump(count($g)); var_dump($g);
Output for 5.6.8 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.10, 7.2.0 - 7.2.33, 7.3.16 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.19, 8.3.0 - 8.3.7
int(0) array(0) { }
Output for 5.5.24 - 5.5.35
Notice: Use of undefined constant ARRAY_FILTER_USE_KEY - assumed 'ARRAY_FILTER_USE_KEY' in /in/frgTD on line 8 Warning: array_filter() expects at most 2 parameters, 3 given in /in/frgTD on line 8 int(0) NULL

preferences:
142.2 ms | 402 KiB | 183 Q