private function highlight($str, $start, $length) {
        $parts = array(
            substr($str, 0, $start),
            substr($str, $start, $length),
            substr($str, $start + $length)
        );

        $parts = array_map('htmlentities', $parts);

        $highlighted  = $parts[0] . '<span class="' . $this->highlightClassName . '">';
        $highlighted .= $parts[1] . '</span>' . $parts[2];

        return $highlighted;
    }
private function highlight($str, $start, $length) {
        $parts = array(
            substr($str, 0, $start),
            substr($str, $start, $length),
            substr($str, $start + $length)
        );

        $parts = array_map('htmlentities', $parts);

        $highlighted  = $parts[0] . '<span class="' . $this->highlightClassName . '">';
        $highlighted .= $parts[1] . '</span>' . $parts[2];

        return $highlighted;
    }
private function highlight ( $ str , $ start , $ length ) { $ parts = array ( substr ( $ str , 0 , $ start ) , substr ( $ str , $ start , $ length ) , substr ( $ str , $ start + $ length ) ) ; $ parts = array_map ( 'htmlentities' , $ parts ) ; $ highlighted = $ parts [ 0 ] . '<span class="' . $ this -> highlightClassName . '">' ; $ highlighted .= $ parts [ 1 ] . '</span>' . $ parts [ 2 ] ; return $ highlighted ; }
Highlight the given string, enclosing it in a span

@param  string $str    String to highlight
@param  int    $start  Start index of substring to highlight
@param  int    $length Length of substring to highlight
@return string
Highlight the given string enclosing it in a span