array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'de', ), 'this' => array ( 0 => 'class.phptoken.php', 1 => 'PhpToken', ), 'up' => array ( 0 => 'book.tokenizer.php', 1 => 'Tokenizer', ), 'prev' => array ( 0 => 'tokenizer.examples.php', 1 => 'Beispiele', ), 'next' => array ( 0 => 'phptoken.construct.php', 1 => 'PhpToken::__construct', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'en', 'path' => 'reference/tokenizer/phptoken.xml', ), 'extra_header_links' => array ( 'rel' => 'alternate', 'href' => '/manual/en/feeds/class.phptoken.atom', 'type' => 'application/atom+xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 8)
This class provides an alternative to token_get_all(). While the function returns tokens either as a single-character string, or an array with a token ID, token text and line number, PhpToken::tokenize() normalizes all tokens into PhpToken objects, which makes code operating on tokens more memory efficient and readable.
One of the T_* constants, or an ASCII codepoint representing a single-char token.
The textual content of the token.
The starting line number (1-based) of the token.
The starting position (0-based) in the tokenized string (the number of bytes).