On Wed, Apr 17, 2002 at 01:01:29AM +0200, M�rten Gustafsson wrote :
> Is there anyone else than me that would find it useful to be able to do:
>
> <?php
> $string = 'foo bar';
> $replacements = array(
> 'foo' => 'FOO',
> 'bar' => 'BAR');
> // Prints "FOO BAR"
> echo str_replace($replacements, $string);
> ?>
>
> With current behaviour one has to do:
>
> <?php
> $string = 'foo bar';
> $replacements = array(
> 'foo' => 'FOO',
> 'bar' => 'BAR');
> // Prints "FOO BAR"
> echo str_replace(array_keys($replacements), array_values($string));
> ?>
The syntax is str_replace(search, replace, subject), btw.
Personally, I don't see a need for this. On the other side,
if it gets done, think about BC.
--
Please always Cc to me when replying to me on the lists.
GnuPG Key: http://guru.josefine.at/~mfischer/C2272BD0.asc
"Mind if I MFH ?" "What QA did you do on it?" "the usual?" "ah... none :)"
--
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php