here is a simple example:
$correction = "game";
$text ="Hello this is an example of a $word that starts with a $dollar sign";
$text = str_replace("\$word",$correct,$text);
if I echo $text it will say : hello this is an example of a game that starts with a dollar sign. that works just fine.
Now I want to be able to change any word that starts with a dollar sign into game
so it will change all the words that start with $ and turn them into the word “game”
any ideas please ?
You’ll need a regex for this: