View Single Post
Old 01-22-2007, 12:10 PM   #3 (permalink)
markster
Code Monkey
 
markster's Avatar
 
Join Date: Jun 2006
Posts: 65
markster is on a distinguished road
I'm running this script:

PHP Code:
<?php 
$input 
"words to be highlighted";
$words explode(" ",$input);
$string "i need to have all the words in this string highlighted if they are from the array above";
$search_words explode(" ",$string);
foreach (
$word_match in $search_words) {
    foreach (
$word_string in $words) {
        if (
$word_string==$word_match) {
            
$msg .= "<b>$word_match<b> ";
        } else {
            
$msg .= "$word_match ";
        }
    }
}
echo(
$msg);
?>
But I get this error:

Parse error: parse error, unexpected T_STRING in /home/fhlinux178/s/stuff4web.co.uk/user/htdocs/tests/desc-highlight.php on line 6
markster is offline   Reply With Quote