note 76616 deleted from function.str-replace by bjori

From: Date: Tue, 24 Jul 2007 11:16:54 +0000
Subject: note 76616 deleted from function.str-replace by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-128873@lists.php.net to get a copy of this message
Note Submitter: Dogus Reason: useless ---- Another case insensitive string highlight function; function highlightText($txt,$orgStr){ $upperTxt = strtoupper($txt); $lowerTxt = strtolower($txt); $newStr = str_replace($upperTxt,'<span class="highlighted">'.$upperTxt.'</span>',$orgStr); return str_replace($lowerTxt,'<span class="highlighted">'.$lowerTxt.'</span>',$newStr); } And add this definition to your css file; .highlighted{background-color:yellow;/*or something else*/} That's all, have fun ;)

« previous php.notes (#128873) next »