preg_replace

$str = "Visit Microsoft!";
$regex = "/microsoft/i";
// Output: Visit QuickRef!
echo preg\_replace($regex, "QuickRef", $str); 
Comments