| Welcome to WebmasterWorld Guest from 18.104.22.168 |
register, free tools, login, search, subscribe, help, library, announcements, recent posts, open posts,
|Accredited PayPal World Seller|
|php preg replace array|
| 6:26 am on Nov 10, 2009 (gmt 0)|
how do you replace a value with an array of values several times?
| 4:49 pm on Nov 10, 2009 (gmt 0)|
$find_array = array('foo','bar');
$replace_array = array('moo','car');
$string = 'foo bar';
echo str_replace($find_array, $replace_array, $string);
| 9:47 pm on Nov 10, 2009 (gmt 0)|
everyone does replace with both find an array and the replace an array. how do you do it with just the replace an array?
| 10:42 pm on Nov 10, 2009 (gmt 0)|
Because, the occurance of the first element in the replace array would overwrite all occurances of the find making the additional replaces irrelevant.
All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
© Webmaster World 1996-2014 all rights reserved