<?php $user_entered_globals = array("test1", "test2", "test3"); if(!in_array($_GET['test'], $user_entered_globals)) { die("Error!"); } function something() { global $user_entered_globals; eval('$user_entered_globals'); } ?>