note 88254 added to function.strip-tags

From: Date: Sat, 17 Jan 2009 10:01:10 +0000
Subject: note 88254 added to function.strip-tags
Groups: php.notes 
Request: Send a blank email to php-notes+get-149365@lists.php.net to get a copy of this message
strip_tags will strip '<' and the string behind, like this <?php $str = <<<EOF 123 < 456 <a>link</a> bbb EOF; echo strip_tags($str); ?> will output: 123 --------------------------------- this function will repiar this <?php function will_strip_tags($str) { do { $count = 0; $str = preg_replace('/(<)([^>]*?<)/' , '&lt;$2' , $str , -1 , $count); } while ($count > 0); $str = strip_tags($str); $str = str_replace('>' , '&gt;' , $str); return $str; } echo will_strip_tags($str); ?> will output: 123 &lt; 456 link bbb ---- Server IP: 221.194.139.225 Probable Submitter: 61.145.145.167 ---- Manual Page -- http://www.php.net/manual/en/function.strip-tags.php Edit -- https://master.php.net/note/edit/88254 Del: integrated -- https://master.php.net/note/delete/88254/integrated Del: useless -- https://master.php.net/note/delete/88254/useless Del: bad code -- https://master.php.net/note/delete/88254/bad+code Del: spam -- https://master.php.net/note/delete/88254/spam Del: non-english -- https://master.php.net/note/delete/88254/non-english Del: in docs -- https://master.php.net/note/delete/88254/in+docs Del: other reasons-- https://master.php.net/note/delete/88254 Reject -- https://master.php.net/note/reject/88254 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#149365) next »