note 21964 modified in function.str-replace by torben
| From: | torben@php.net | Date: | Sat, 01 Jun 2002 21:43:24 +0000 |
| Subject: | note 21964 modified in function.str-replace by torben | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-31333@lists.php.net to get a copy of this message | ||
str_replace() does not like to be nested.
This example generates an error:
$xExp = "Example for Me to replace This.";
$xStr =
str_replace("Me","With",str_replace("This","That",$xExp));
You'll have to separate your statements like this:
$xExp = "Example for Me to replace This.";
$xStr = str_replace("Me","With",$xExp);
$xStr = str_replace("This","That",$xStr);
--was--
str_replace() does not like to be nested.
This example generates an error:
$xExp = "Example for Me to replace This.";
$xStr =
str_replace("Me","With",str_replace("This","That",$xExp));
You'll have to separate your statements like this:
$xExp = "Example for Me to replace This.";
$xStr = str_replace("Me","With",$xExp);
$xStr = str_replace("This","That",$xStr);
http://www.php.net/manual/en/function.str-replace.php