- preg_quote: documentation ( source)
- preg_replace: documentation ( source)
<?php
$sentence='This is the sentence to be searhed through';
$search = 'sent';
$result = preg_replace("/" . preg_quote($search, "/") . "/ui", "<strong style='color:yellow'>$0</strong>", $sentence);
echo $result;