3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Get rid of the global $_GET variable unset($_GET); // Recreate it as a closure $_GET = function($varName) { return filter_input(INPUT_GET, 'test', FILTER_SANITIZE_STRING); // a closure must have a semicolon at the end }; ?> <hr> Globals variables defined after creating function: <br/> <?php var_dump($GLOBALS); ?> <?php // get query string variable 'test' $var = $_GET('test'); ?> My var is <?= $var; ?> <hr> <?php if (filter_has_var ( INPUT_GET , 'test' )) { echo 'input get has test'; } else { echo 'input get has not test'; }

preferences:
29.88 ms | 402 KiB | 5 Q