note 95640 deleted from function.str-replace by danbrown
| From: | danbrown@php.net | Date: | Wed, 13 Jan 2010 17:20:18 +0000 |
| Subject: | note 95640 deleted from function.str-replace by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164935@lists.php.net to get a copy of this message | ||
Note Submitter: P.E.T.E.R.
----
@Wes Foster
...or you could use strtr()
<?php
$replace = array(
'dog' => 'cat',
'apple' => 'orange'
'chevy' => 'ford'
);
$string = 'I like to eat an apple with my dog in my chevy';
echo strtr($string,$replace);
// Echo: I like to eat an orange with my cat in my ford
?>