note 21008 deleted from function.preg-match-all by victor
| From: | victor@php.net | Date: | Wed, 04 Dec 2002 11:05:26 +0000 |
| Subject: | note 21008 deleted from function.preg-match-all by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-40332@lists.php.net to get a copy of this message | ||
i've worked hard to get this shit working.. i wanna have a script wich replaces everything with
its htmlchars but not html-tags itself.
<?php
$text = "I am HTML ööö with tags such as <a href=\"http://www.google.de\">möw</a>
in it <b>öö</b> mow";
preg_match_all( '/(.*?)(\<.+?\>)(.*?)/', $text, $text2 );
for($i=0;$i<count($text2[1]);$i++) {
$text=str_replace($text2[1][$i],htmlentities($text2[1][$i]),$text);
}
echo $text;
?>