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.

About Author Mr.Bazz

Hi thanks for dropping by. Please share the content if you think there is someone who will appreciate it.

Leave A Comment

Your email address will not be published. Required fields are marked *