Hello, Is this possibe via php and if possible can you tell me how i can change words in text. Example : I have a text where i want to change the word bike in the word car and the word car in the word bike in the same text. I know how to change one word and replace it by another but the problem is if i change all the words bike in car then if change car in bike all the words are replaced in bike and thats not what i want. I want car -> bike and bike -> car to be changed from the original text. Cheers, Kris
If you want to swap words then you will need a temporary third word, something like this: function SwapWords( $Text, $WordOne, $WordTwo ) { $Text = str_replace( $WordOne, 'TEMPWORD', $Text ); $Text = str_replace( $WordTwo, $WordOne, $Text ); $Text = str_replace( 'TEMPWORD', $WordTwo, $Text ); return $Text; } PHP: Brew