note 46101 modified in function.strip-tags by danbrown

From: Date: Sun, 17 May 2009 16:04:51 +0000
Subject: note 46101 modified in function.strip-tags by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-154756@lists.php.net to get a copy of this message
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("<!--", "&lt;!--", $text); $text = preg_replace("/(\<)(.*?)(--\>)/mi", "".nl2br("\\2")."", $text); return $text; } ?> it will show all the text without tags and (!!!) without javascripts --was-- if you only want to have the text within the tags, you can use this function: function showtextintags($text) { $text = preg_replace("/(\<script)(.*?)(script>)/si", "dada", "$text"); $text = strip_tags($text); $text = str_replace("<!--", "&lt;!--", $text); $text = preg_replace("/(\<)(.*?)(--\>)/mi", "".nl2br("\\2")."", $text); return $text; } it will show all the text without tags and (!!!) without javascripts http://php.net/manual/en/function.strip-tags.php

« previous php.notes (#154756) next »