<?php array_walk($_REQUEST, 'protect'); array_walk($_GET, 'protect'); function protect(&$value, $key) { $value = trim($value); } ?>