i've asked same question before here, but now i need to higlight the keywortd in another way, then other part of word. example will be helpful i think
$str = "i like programming very much";
$key = "gram";
i need to get something like pro gram ming
$str = "i like <span class='first'>pro</span><span class='second'>gram</span><span class='firs'>ing</span>"
why preg_replace("/([^\s]*?)(".preg_quote($key).")([^\s]*)/iu","<span class="first">$0</span><span class="second">$1</span><span class="first">$2</span>",$str);
doesn't work?
Thanks