Zend - The PHP Company




Code Gallery: Souldrinker


Highlight  

Type: code fragment
Added by: Souldrinker
Entered: 10/08/2001
Last modified: 08/12/2000
Rating: - (fewer than 3 votes)
Views: 5472
This Function allows it to highlight assigned Parts (needle) of a string (hystack) with pre defined HTML-Tags by only once call of function. Surely, in PHP4 it would be much easier to realise such a function - but this function works in PHP3, too. To define the tags that highlight the needle in the hystack-string use an array consisting of two values [0] (for opening the tag(s)) and [1] (for closing the tag(s)). The function doesn't do any echo's, it only returns the value, so you have to call it in order with echo to write what it returns.




Search