I wrote a search script, now I want a more efficient way of finding the keywords used for the search and make them bold. I used this code but it I feel it could be greatly improved on. Thanks for any suggestion.// I use this code to select the lines to display$lines = explode('.', trim($search_result));// Break up the result into sentences$j = 0; $line = '';for($i = 0; $i < sizeof($lines); $i++) {    // Look for the keywords in each of the line            if (strstr($lines[$i], $keywords[0]) || strstr($lines[$i], $keywords[1]) ||         strstr($lines[$i], $keywords[2]) || strstr($lines[$i], $keywords[3])    ) {        $j++;        $line .= trim($lines[$i])....;    }    if ($j == 2)        return $line;    // If no keyword is found in first 100 lines/sentences, just display the first 3 lines    if ($i == 100)        return $lines[0].....$lines[1].....$lines[2];}I use this code to make the keywords boldfunction findAndReplace($keywords, $sentence) {    for ($i=0; $i<sizeof($keywords); $i++)        $words[] = <b>.ucfirst($keywords[$i]).</b>;    return str_ireplace($keywords, $words, $sentence);}
Please help and improve this script for displaying search results
php