09-05-2009, 05:25 PM
|
#3 (permalink)
|
|
The Addict
Join Date: Aug 2008
Posts: 336
Thanks: 8
|
or you can also use the translate function:
php Code:
<?php$string = 'The quick brown {fox} jumps over the lazy {dog}'; $arr = array("{fox}" => "cat", "{dog}" => "mouse"); echo 'before: ' . $string . "\n"; $string = strtr($string, $arr); echo 'after: ' . $string; ?>
|
|
|
|