Quick Search:
 
 PHP Code: Highlight Words #2 Jump to:  
Category: >> PHP Code >> Highlight Words #2  

<< lastnext >>

Snippet Name: Highlight Words #2

Description: Highlight words in a string.

Comment: (none)

Language: PHP
Highlight Mode: PHP
Last Modified: February 27th, 2009

<?PHP
 
FUNCTION highlight($haystack,$needle){
   $haystack=PREG_REPLACE("/($needle)/i","<span style='font-weight:bold'>\${1}</span>",$haystack);
   RETURN $haystack;
}
 
?>


 
   Home |    Search |    Code Library |    Sponsors |    Privacy |    Terms of Use |    Contact Us © 2003 - 2024 psoug.org