note 19031 modified in function.str-replace by victor
| From: | victor@php.net | Date: | Sun, 25 Aug 2002 06:07:55 +0000 |
| Subject: | note 19031 modified in function.str-replace by victor | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-35575@lists.php.net to get a copy of this message | ||
[Editor's note: If you think this is not what you want, consider using
echo strtr('xxaxx', array('x' => 'y', 'y' =>
'z')); ]
An example to illustrate the transitive property of the array substitution behaviour:
[ik@budapest www]$ php -q
<?
echo str_replace(array('x', 'y'), array('y', 'z'),
'xxaxx');
?>
zzazz
[ik@budapest www]$
This may or may not be what you want, but you should be aware of it in any case.
--was--
An example to illustrate the transitive property of the array substitution behaviour:
[ik@budapest www]$ php -q
<?
echo str_replace(array('x', 'y'), array('y', 'z'),
'xxaxx');
?>
zzazz
[ik@budapest www]$
This may or may not be what you want, but you should be aware of it in any case. This is on
php4.0.5.
http://www.php.net/manual/en/function.str-replace.php