Use str_replace() to replace all occurrences of a search string with a replacement string.
Source Code
$text = "The quick brown fox jumps over the lazy dog.";
$replaced = str_replace("brown", "red", $text);
echo $replaced; // Outputs: The quick red fox jumps over the lazy dog.