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.

Caruman TAKAFUL serendah RM15, manfaat sehingga RM2 juta. Promosi hujung tahung, ending soon!
Wasap SEKARANG!

Leave a Reply

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