public function searchIn( $text ) {
		if ( !$this->searchKeywords || $text === '' ) {
			return [];  // fast path
		}

		$state = 0;
		$results = [];
		$length = strlen( $text );

		for ( $i = 0; $i < $length; $i++ ) {
			$ch = $text[$i];
			$state = $this->nextState( $state, $ch );
			foreach ( $this->outputs[$state] as $match ) {
				$offset = $i - $this->searchKeywords[$match] + 1;
				$results[] = [ $offset, $match ];
			}
		}

		return $results;
	}
public function searchIn( $text ) {
		if ( !$this->searchKeywords || $text === '' ) {
			return [];  // fast path
		}

		$state = 0;
		$results = [];
		$length = strlen( $text );

		for ( $i = 0; $i < $length; $i++ ) {
			$ch = $text[$i];
			$state = $this->nextState( $state, $ch );
			foreach ( $this->outputs[$state] as $match ) {
				$offset = $i - $this->searchKeywords[$match] + 1;
				$results[] = [ $offset, $match ];
			}
		}

		return $results;
	}
public function searchIn ( $ text ) { if ( ! $ this -> searchKeywords || $ text === '' ) { return [ ] ; // fast path } $ state = 0 ; $ results = [ ] ; $ length = strlen ( $ text ) ; for ( $ i = 0 ; $ i < $ length ; $ i ++ ) { $ ch = $ text [ $ i ] ; $ state = $ this -> nextState ( $ state , $ ch ) ; foreach ( $ this -> outputs [ $ state ] as $ match ) { $ offset = $ i - $ this -> searchKeywords [ $ match ] + 1 ; $ results [ ] = [ $ offset , $ match ] ; } } return $ results ; }
Locate the search keywords in some text.

@param string $text The string to search in.
@return array[] An array of matches. Each match is a vector
containing an integer offset and the matched keyword.

@par Example:
@code
$keywords = new MultiStringMatcher( array( 'ore', 'hell' ) );
$keywords->searchIn( 'She sells sea shells by the sea shore.' );
// result: array( array( 15, 'hell' ), array( 34, 'ore' ) )
@endcode
Locate the search keywords in some text .