note 96159 added to function.htmlspecialchars
| From: | alif at osu1 dot php dot net | Date: | Thu, 11 Feb 2010 17:17:23 +0000 |
| Subject: | note 96159 added to function.htmlspecialchars | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-165877@lists.php.net to get a copy of this message | ||
I had XML files with both '&' , '©right;' and '&'
characters. So, basically, I wrote this preg_replace, which replaces all '&' thats not
an entity to '&'.
So '&' doesnot get converted to '&', only '&'
gets converted to '&'. Also, '©right;' , ' '
remains unaffected. Its basic, feel free to modify it.
preg_replace('/&(?![A-Za-z0-9#]{1,7};)/','&',$theString);
----
Server IP: 216.235.13.26
Probable Submitter: 174.90.33.100
----
Manual Page -- http://www.php.net/manual/en/function.htmlspecialchars.php
Edit -- https://master.php.net/note/edit/96159
Del: integrated -- https://master.php.net/note/delete/96159/integrated
Del: useless -- https://master.php.net/note/delete/96159/useless
Del: bad code -- https://master.php.net/note/delete/96159/bad+code
Del: spam -- https://master.php.net/note/delete/96159/spam
Del: non-english -- https://master.php.net/note/delete/96159/non-english
Del: in docs -- https://master.php.net/note/delete/96159/in+docs
Del: other reasons-- https://master.php.net/note/delete/96159
Reject -- https://master.php.net/note/reject/96159
Search -- https://master.php.net/manage/user-notes.php