note 118785 added to function.str-replace
| From: | DavidHolt | Date: | Fri, 05 Feb 2016 14:59:16 +0000 |
| Subject: | note 118785 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-204871@lists.php.net to get a copy of this message | ||
Be aware that if you use this for filtering & sanitizing some form of user input, or remove ALL
instances of a string, there's another gotcha to watch out for:
// Remove all double characters
$string="1001011010";
$string=str_replace(array("11","00"),"",$string);
// Output: "110010"
$string="<ht<html>ml> Malicious code </<html>html> etc";
$string=str_replace(array("<html>","</html>"),"",$string);
// Output: "<html> Malicious code </html> etc"
----
Server IP: 72.52.91.14
Probable Submitter: 81.149.224.79
----
Manual Page -- http://php.net/manual/en/function.str-replace.php
Edit -- https://master.php.net/note/edit/118785
Del: integrated -- https://master.php.net/note/delete/118785/integrated
Del: useless -- https://master.php.net/note/delete/118785/useless
Del: bad code -- https://master.php.net/note/delete/118785/bad+code
Del: spam -- https://master.php.net/note/delete/118785/spam
Del: non-english -- https://master.php.net/note/delete/118785/non-english
Del: in docs -- https://master.php.net/note/delete/118785/in+docs
Del: other reasons-- https://master.php.net/note/delete/118785
Reject -- https://master.php.net/note/reject/118785
Search -- https://master.php.net/manage/user-notes.php