View Single Post
Old 01-22-2007, 06:55 AM   #1 (permalink)
markster
Code Monkey
 
markster's Avatar
 
Join Date: Jun 2006
Posts: 65
markster is on a distinguished road
Highlight certain words in an string

What i need to do is take a string and highlight only certain words. But the words that need highlighting must come from a string that the user inputs. What I have so far:

PHP Code:
<?php
$input 
"words to be highlighted"//The word that need to be highlighted
$words explode(" ",$input); //Split the words into an array
$string "i need to have all the words in this string highlighted if they are from the array above"//The string that needs to be searched for the above words
$search_words explode(" ",$string); //Split the above string word-by-word
?>
Then I have no idea how to check the arrays against each other. Please help!
markster is offline   Reply With Quote