note 17167 added to function.ereg-replace

From: Date: Wed, 28 Nov 2001 16:03:51 +0000
Subject: note 17167 added to function.ereg-replace
Groups: php.notes 
Request: Send a blank email to php-notes+get-21380@lists.php.net to get a copy of this message
Just a quite note to show how to (case-insensitively) highlight a keyword in a block of text, whilst preserving the case of the keyword as it is found in the text, rather than replacing it with the case of the keyword that you are searching with. Good for site search engines. //$key is your search word $expandedkey=sql_regcase($key); $blockoftext=ereg_replace($expandedkey,"<b><font color=\"#FF0000\">\\0</font></b>", $blockoftext); -- http://www.php.net/manual/en/function.ereg-replace.php http://master.php.net/manage/user-notes.php?action=edit+17167 http://master.php.net/manage/user-notes.php?action=delete+17167 http://master.php.net/manage/user-notes.php?action=reject+17167

« previous php.notes (#21380) next »