| Welcome to WebmasterWorld Guest from 188.8.131.52 |
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
|Become a Pro Member|
|php preg replace array|
how do you replace a value with an array of values several times?
$find_array = array('foo','bar');
$replace_array = array('moo','car');
$string = 'foo bar';
echo str_replace($find_array, $replace_array, $string);
everyone does replace with both find an array and the replace an array. how do you do it with just the replace an array?
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.
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved