token_get_all
PHP 4 >= 4.2.0, PHP 5, PHP 7, PHP 8
token_get_all - Split given source into PHP tokens
Manual
token_get_all(
string$code,
[int$flags = 0] ): array
token_get_all parses the given code string into PHP language tokens using the Zend engine's lexical scanner.
For a list of parser tokens, see , or use token_name to translate a token value into its string representation.
Parameters
- code
-
The PHP source to parse.
- flags
-
Valid flags:
TOKEN_PARSE - Recognises the ability to use reserved words in specific contexts.
Return Values
An array of token identifiers. Each individual token identifier is either a single character (i.e.: ;, ., >, !, etc...), or a three element array containing the token index in element 0, the string content of the original token in element 1 and the line number in element 2.