foreach ($var as $index => &$value) { $value = htmlspecialchars(stripcslashes(addslashes(strip_tags(trim($value))))); return $var; }