function unstripinput($text) { if (!is_array($text)) { $text = stripslash(trim($text)); $search = array("&", """, "'", "\", """, "'", "<", ">"); $replace = array("&", "\"", "'", "\\", '\"', "\'", "<", ">"); $text = preg_replace("/(&)+(?=\#([0-9]{2,3});)/i", "&", str_replace($search, $replace, $text)); } else { foreach ($text as $key => $value) { $text[$key] = unstripinput($value); } } return $text; }