string replace php - one word to more words -


hi need particulary type of string replace in php. need replace word 2 different others words.

for example: in string "hi mom, hi dad" need automatically replace word "hi" 2 other different, example "mary" , "john". if there 1 occurrence of "hi" replace "mary" if there more 1 uses association of words.

so, 1 word more replaces based on how many times word occurrence. can me!

preg_replace_callback lets control each replacement.


Comments

Popular posts from this blog

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -

iphone - How would you achieve a LED Scrolling effect? -