function filter($text) { return htmlspecialchars(strip_tags(trim($text))); } $_GET = array_map('filter',$_GET); $_POST = array_map('filter',$_POST);