note 89878 added to function.strip-tags
| From: | hongong at webafrica dot org dot za | Date: | Thu, 26 Mar 2009 20:52:17 +0000 |
| Subject: | note 89878 added to function.strip-tags | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-152495@lists.php.net to get a copy of this message | ||
An easy way to clean a string of all CDATA encapsulation.
function strip_cdata($string)
{
preg_match_all('/<!\[cdata\[(.*?)\]\]>/is', $string, $matches);
return str_replace($matches[0], $matches[1], $string);
}
Example: echo strip_cdata('<![CDATA[Text]]>');
Returns: Text
----
Server IP: 69.147.83.197
Probable Submitter: 196.25.255.214
----
Manual Page -- http://www.php.net/manual/en/function.strip-tags.php
Edit -- https://master.php.net/note/edit/89878
Del: integrated -- https://master.php.net/note/delete/89878/integrated
Del: useless -- https://master.php.net/note/delete/89878/useless
Del: bad code -- https://master.php.net/note/delete/89878/bad+code
Del: spam -- https://master.php.net/note/delete/89878/spam
Del: non-english -- https://master.php.net/note/delete/89878/non-english
Del: in docs -- https://master.php.net/note/delete/89878/in+docs
Del: other reasons-- https://master.php.net/note/delete/89878
Reject -- https://master.php.net/note/reject/89878
Search -- https://master.php.net/manage/user-notes.php