src/Support/Highlighter.php
public function _extractLocations($words, $fulltext)
    {
        $locations = array();
        foreach ($words as $word) {
            $wordlen = strlen($word);
            $loc     = stripos($fulltext, $word);
            while ($loc !== false) {
                $locations[] = $loc;
                $loc         = stripos($fulltext, $word, $loc + $wordlen);
            }
        }
        $locations = array_unique($locations);
        sort($locations);

        return $locations;
    }
public function _extractLocations($words, $fulltext)
    {
        $locations = array();
        foreach ($words as $word) {
            $wordlen = strlen($word);
            $loc     = stripos($fulltext, $word);
            while ($loc !== false) {
                $locations[] = $loc;
                $loc         = stripos($fulltext, $word, $loc + $wordlen);
            }
        }
        $locations = array_unique($locations);
        sort($locations);

        return $locations;
    }
public function _extractLocations ( $ words , $ fulltext ) { $ locations = array ( ) ; foreach ( $ words as $ word ) { $ wordlen = strlen ( $ word ) ; $ loc = stripos ( $ fulltext , $ word ) ; while ( $ loc !== false ) { $ locations [ ] = $ loc ; $ loc = stripos ( $ fulltext , $ word , $ loc + $ wordlen ) ; } } $ locations = array_unique ( $ locations ) ; sort ( $ locations ) ; return $ locations ; }
find the locations of each of the words
Nothing exciting here. The array_unique is required
unless you decide to make the words unique before passing in

@param $words
@param $fulltext

@return array
find the locations of each of the words Nothing exciting here . The array_unique is required unless you decide to make the words unique before passing in