Hope this helps
$str ="your whole string ";
if(isset($_POST['searchStr']))
{
$searchStr= $_POST['searchStr'];
$str= str_replace($searchStr,''. $searchStr.'',$str);
}
echo "$str";
if you want a case -insensitive replacement use below function
str_ireplace() - Case-insensitive version of str_replace.