PHP: replace words but keep original format

$original = “The quick red fox jumps over the lazy brown dog.”;
$new = preg_replace(“/the/i”, “\$0“, $original);

Source here.

Prev PostMicrosoft Outlook attachment folder
Next PostSerialize array safely

Leave a reply