note 79997 added to function.eregi-replace

From: Date: Sun, 23 Dec 2007 12:40:05 +0000
Subject: note 79997 added to function.eregi-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-133894@lists.php.net to get a copy of this message
Nice way to highlight that what someone search. For example is some one search for "Wire Mobile 6" It will highlight every word separated even if found "Wire Xp and some mobile stuff" © and ® are importiant, because without special signs, string in second turn will convert also <span class="searchtext"> which will be already in text. <? $searchcolor = explode(' ',$search); $ilosc = count($searchcolor); $ilosc2 = "0"; while ($ilosc2 != $ilosc ) { $name = eregi_replace ($searchcolor[$ilosc2],'©'.$searchcolor[$ilosc2].'®',$name); $ilosc2++; } $name = str_replace('©','<span class="searchtext">',$name); $name = str_replace('®','</span>',$name); echo $name; ?> ---- Server IP: 82.177.164.100 Probable Submitter: 83.30.135.74 ---- Manual Page -- http://www.php.net/manual/en/function.eregi-replace.php Edit -- https://master.php.net/note/edit/79997 Del: integrated -- https://master.php.net/note/delete/79997/integrated Del: useless -- https://master.php.net/note/delete/79997/useless Del: bad code -- https://master.php.net/note/delete/79997/bad+code Del: spam -- https://master.php.net/note/delete/79997/spam Del: non-english -- https://master.php.net/note/delete/79997/non-english Del: in docs -- https://master.php.net/note/delete/79997/in+docs Del: other reasons-- https://master.php.net/note/delete/79997 Reject -- https://master.php.net/note/reject/79997 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#133894) next »