note 98370 deleted from function.str-replace by cmb
| From: | cmb@php.net | Date: | Sun, 15 Sep 2019 14:46:55 +0000 |
| Subject: | note 98370 deleted from function.str-replace by cmb | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-212208@lists.php.net to get a copy of this message | ||
Note Submitter: cableray
----
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.