The below function can strip almost all tags from a string.   function strip_all_tags($string)  {      $string = preg_replace( '@<(script|style)[^>]*?>.*?@si', '', $string );      $string = strip_tags($string);      return trim($string);  }   $a = '<script type="text/javascript" src="jquery.js"></script>  <div id="test" style="padding:5px; color:red;">Hello world</div>';   echo strip_all_tags($a); // outputs: Hello world
Comments
Post a Comment