note 84460 deleted from function.str-ireplace by tularis
| From: | tularis@php.net | Date: | Tue, 15 Jul 2008 12:49:07 +0000 |
| Subject: | note 84460 deleted from function.str-ireplace by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-141531@lists.php.net to get a copy of this message | ||
Note Submitter: shk dot naim at gmail dot com
Reason: useless
----
Here is the example of str_ireplace() using explode & implode
for making highlighted search keywords:-
$n; #searching text
$kw=explode(' ',$keyword);
for($i=0;$i<count($kw);$i++)
{
$n=explode(' ',$n);
$n1=str_ireplace($kw[$i],'<span
class="highlight_word">'.$kw[$i].'</span>',$n);
$n=implode(' ',$n1);
}
echo $n;
?>
Any corrections encouraged.