note 11517 deleted from str_replace by ronabop
| From: | ronabop@php.net | Date: | Sun, 25 Feb 2001 02:41:49 +0000 |
| Subject: | note 11517 deleted from str_replace by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-11571@lists.php.net to get a copy of this message | ||
[Editor's note: Perhaps the wording of the description needs to be even more clear than it is,
but the prototype clearly states:
mixed str_replace (mixed search, mixed replace, mixed subject)
It does not indicate that the function returns (void) or (boolean) as functions that change directly
their arguments usually do. And the example should also be a hint on this behaviour, which should
make things clear if the description of the process and the prototype did not.]
This function does _NOT_ (as the introduction says) "Replace all occurrences of the search
string in subject with the replacement string"
... instead it _returns_ a copy of subject with all occurrences of the search string replaced with
the replacement string.
str_replace("x", "y", $str) does nothing....
$str = str_replace("x", "y", $str) does what the introduction says.