I want to replace multiple synonyms with one specific word.
Something like
$a = array( 'truck', 'vehicle', 'seddan', 'coupe' );
$str = 'Honda is a truck. Toyota is a vehicle. Nissan is a sedan. Scion is a coupe.';
echo str_replace($a,'car',$str);
Should work.
http://codepad.org/1LhtcOSR
Edit:
Something like this should yield expected results: http://pastebin.com/xGzYiCk3
$text = '{test|test2|test3} some other stuff {some1|some2|some3}';
Output:
test3 some other stuff some1 test2 some other stuff some2 test3 some other stuff some3 test3 some other stuff some1