public function takeAllAlphaNumUntil(string $ends): string
    {
        $ends = self::split($ends);

        $ends[] = "alphanumeric";

        $taken = "";

        while (ctype_alnum($this->peek())) {
            $char = $this->take();

            $taken .= $char;
        }

        $this->latestExpectations = $ends;

        if (!in_array($this->peek(), $ends)) {
            throw new UnexpectedChar($this, $ends);
        }

        return $taken;
    }
public function takeAllAlphaNumUntil(string $ends): string
    {
        $ends = self::split($ends);

        $ends[] = "alphanumeric";

        $taken = "";

        while (ctype_alnum($this->peek())) {
            $char = $this->take();

            $taken .= $char;
        }

        $this->latestExpectations = $ends;

        if (!in_array($this->peek(), $ends)) {
            throw new UnexpectedChar($this, $ends);
        }

        return $taken;
    }
public function takeAllAlphaNumUntil ( string $ ends ) : string { $ ends = self :: split ( $ ends ) ; $ ends [ ] = "alphanumeric" ; $ taken = "" ; while ( ctype_alnum ( $ this -> peek ( ) ) ) { $ char = $ this -> take ( ) ; $ taken .= $ char ; } $ this -> latestExpectations = $ ends ; if ( ! in_array ( $ this -> peek ( ) , $ ends ) ) { throw new UnexpectedChar ( $ this , $ ends ) ; } return $ taken ; }
Removes all alphanumeric characters from the input until one of the end
characters is encountered. Returns the removed alphanumeric string.

@param string $ends
@return string
@throws UnexpectedChar
Removes all alphanumeric characters from the input until one of the end characters is encountered . Returns the removed alphanumeric string .