note 98370 added to function.str-replace
| From: | cableray at osu1 dot php dot net | Date: | Fri, 11 Jun 2010 07:03:09 +0000 |
| Subject: | note 98370 added to function.str-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-170047@lists.php.net to get a copy of this message | ||
If you wish to get around the 'gotcha', you could do something like this:
<?php
$find=array('a', 'p', '^', '*');
$replace = array('^', '*', 'apple', 'pear');
str_replace($find, $replace, 'a p');
?>
The idea here is that you first replace the items you want with unique identifiers (that you are
unlikely to find in the subject) and then search for those identifiers and then replace them.
----
Server IP: 69.147.83.197
Probable Submitter: 71.56.222.64
----
Manual Page -- http://www.php.net/manual/en/function.str-replace.php
Edit -- https://master.php.net/note/edit/98370
Del: integrated -- https://master.php.net/note/delete/98370/integrated
Del: useless -- https://master.php.net/note/delete/98370/useless
Del: bad code -- https://master.php.net/note/delete/98370/bad+code
Del: spam -- https://master.php.net/note/delete/98370/spam
Del: non-english -- https://master.php.net/note/delete/98370/non-english
Del: in docs -- https://master.php.net/note/delete/98370/in+docs
Del: other reasons-- https://master.php.net/note/delete/98370
Reject -- https://master.php.net/note/reject/98370
Search -- https://master.php.net/manage/user-notes.php