public function nextState( $currentState, $inputChar ) {
		$initialState = $currentState;
		while ( true ) {
			$transitions =& $this->yesTransitions[$currentState];
			if ( isset( $transitions[$inputChar] ) ) {
				$nextState = $transitions[$inputChar];
				// Avoid failure transitions next time.
				if ( $currentState !== $initialState ) {
					$this->yesTransitions[$initialState][$inputChar] = $nextState;
				}
				return $nextState;
			}
			if ( $currentState === 0 ) {
				return 0;
			}
			$currentState = $this->noTransitions[$currentState];
		}
		// Unreachable outside 'while'
	}
public function nextState( $currentState, $inputChar ) {
		$initialState = $currentState;
		while ( true ) {
			$transitions =& $this->yesTransitions[$currentState];
			if ( isset( $transitions[$inputChar] ) ) {
				$nextState = $transitions[$inputChar];
				// Avoid failure transitions next time.
				if ( $currentState !== $initialState ) {
					$this->yesTransitions[$initialState][$inputChar] = $nextState;
				}
				return $nextState;
			}
			if ( $currentState === 0 ) {
				return 0;
			}
			$currentState = $this->noTransitions[$currentState];
		}
		// Unreachable outside 'while'
	}
public function nextState ( $ currentState , $ inputChar ) { $ initialState = $ currentState ; while ( true ) { $ transitions = & $ this -> yesTransitions [ $ currentState ] ; if ( isset ( $ transitions [ $ inputChar ] ) ) { $ nextState = $ transitions [ $ inputChar ] ; // Avoid failure transitions next time. if ( $ currentState !== $ initialState ) { $ this -> yesTransitions [ $ initialState ] [ $ inputChar ] = $ nextState ; } return $ nextState ; } if ( $ currentState === 0 ) { return 0 ; } $ currentState = $ this -> noTransitions [ $ currentState ] ; } // Unreachable outside 'while' }
Map the current state and input character to the next state.

@param int $currentState The current state of the string-matching
automaton.
@param string $inputChar The character the string-matching
automaton is currently processing.
@return int The state the automaton should transition to.
Map the current state and input character to the next state .