note 46101 deleted from function.strip-tags by aharvey
| From: | aharvey@php.net | Date: | Thu, 20 Sep 2012 11:41:38 +0000 |
| Subject: | note 46101 deleted from function.strip-tags by aharvey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-190905@lists.php.net to get a copy of this message | ||
Note Submitter: @dada
----
if you only want to have the text within the tags, you can use this function:
<?php
function showtextintags($text)
{
$text = preg_replace("/(\<script)(.*?)(script>)/si", "dada",
"$text");
$text = strip_tags($text);
$text = str_replace("<!--", "<!--", $text);
$text = preg_replace("/(\<)(.*?)(--\>)/mi",
"".nl2br("\\2")."", $text);
return $text;
}
?>
it will show all the text without tags and (!!!) without javascripts