I want to replace multiple synonyms with one specific word.
I found a very easy solution to replace multiple words in a string :
output :
Honda is a car.
Toyota is a car.
Nissan is a car.
Scion is a car
With this script you can replace as many words in a string as you want :
just place the word (that you want to replace) in the pattern array , eg :
$pattern[0]="/replaceme/";
and place the characters (that will be used in place of the replaced characters) in the replacement array, eg :
$replacement[0]="new_word";
Happy coding!