note 81337 added to function.eregi-replace
| From: | dan at dotgospel dot com | Date: | Sat, 23 Feb 2008 03:30:38 +0000 |
| Subject: | note 81337 added to function.eregi-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-136430@lists.php.net to get a copy of this message | ||
/*******************************************************
Function highlights the text. You can replace the html tags with whatever you like. $x is the
string, $var is the string to be highlighted. We explode the string to highlight more than one word.
*/
function highlight($x,$var) {
$var = explode(" ",$var);
for($j=0; $j< count($var); $j++){
$xtemp = "";
$i=0;
while($i<strlen($x)){
if((($i + strlen($var[$j])) <= strlen($x)) && (strcasecmp($var[$j],
substr($x, $i, strlen($var[$j]))) == 0)) {
$xtemp .= "<b>" . substr($x, $i , strlen($var[$j])) .
"</b>";
$i += strlen($var[$j]);
}
else {
$xtemp .= $x{$i};
$i++;
}
}
$x = $xtemp;
}
return $x;
}
----
Server IP: 69.147.83.197
Probable Submitter: 219.89.217.37
----
Manual Page -- http://www.php.net/manual/en/function.eregi-replace.php
Edit -- https://master.php.net/note/edit/81337
Del: integrated -- https://master.php.net/note/delete/81337/integrated
Del: useless -- https://master.php.net/note/delete/81337/useless
Del: bad code -- https://master.php.net/note/delete/81337/bad+code
Del: spam -- https://master.php.net/note/delete/81337/spam
Del: non-english -- https://master.php.net/note/delete/81337/non-english
Del: in docs -- https://master.php.net/note/delete/81337/in+docs
Del: other reasons-- https://master.php.net/note/delete/81337
Reject -- https://master.php.net/note/reject/81337
Search -- https://master.php.net/manage/user-notes.php