note 21015 added to function.preg-match-all

From: Date: Thu, 25 Apr 2002 12:30:20 +0000
Subject: note 21015 added to function.preg-match-all
Groups: php.notes 
Request: Send a blank email to php-notes+get-29831@lists.php.net to get a copy of this message
My above expample's wrong ^^. Here's a better 1 but also with some limitations.. <?php function make_my_htmlchars($text) { $chars = preg_split('#(<\/?)(\w+)([^>]*>)#mis', $text, -1, PREG_SPLIT_NO_EMPTY); //print_r($chars); for($i=0;$i<count($chars);$i++) { $text=str_replace($chars[$i],htmlentities($chars[$i]),$text); } return(stripslashes($text)); } $string='Iam just a lame <> string häving ßome lame german <b>chärs</b> MÖH döh! ;>'; echo make_my_htmlchars($string); ?> -- http://www.php.net/manual/en/function.preg-match-all.php http://master.php.net/manage/user-notes.php?action=edit+21015 http://master.php.net/manage/user-notes.php?action=delete+21015 http://master.php.net/manage/user-notes.php?action=reject+21015

« previous php.notes (#29831) next »