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