php man page for token_get_all

Query: token_get_all

OS: php

Section: 3

Format: Original Unix Latex Style Formatted with HTML and a Horizontal Scroll Bar

TOKEN_GET_ALL(3)							 1							  TOKEN_GET_ALL(3)

token_get_all - Split given source into PHP tokens

SYNOPSIS
array token_get_all (string $source)
DESCRIPTION
token_get_all(3) parses the given $source string into PHP language tokens using the Zend engine's lexical scanner. For a list of parser tokens, see "List of Parser Tokens", or use token_name(3) to translate a token value into its string representation.
PARAMETERS
o $source - The PHP source to parse.
RETURN VALUES
An array of token identifiers. Each individual token identifier is either a single character (i.e.: ;, ., >, !, etc...), or a three ele- ment 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.
EXAMPLES
Example #1 token_get_all(3) examples <?php $tokens = token_get_all('<?php echo; ?>'); /* => array( array(T_OPEN_TAG, '<?php'), array(T_ECHO, 'echo'), ';', array(T_CLOSE_TAG, '?>') ); */ /* Note in the following example that the string is parsed as T_INLINE_HTML rather than the otherwise expected T_COMMENT (T_ML_COMMENT in PHP <5). This is because no open/close tags were used in the "code" provided. This would be equivalent to putting a comment outside of <?php ?> tags in a normal file. */ $tokens = token_get_all('/* comment */'); // => array(array(T_INLINE_HTML, '/* comment */')); ?>
CHANGELOG
+--------+----------------------------------------+ |Version | | | | | | | Description | | | | +--------+----------------------------------------+ | 5.2.2 | | | | | | | Line numbers are returned in element 2 | | | | +--------+----------------------------------------+ PHP Documentation Group TOKEN_GET_ALL(3)
Related Man Pages
pathinfo(3) - php
array_count_values(3) - php
array(3) - php
debug_backtrace(3) - php
explode(3) - php
Similar Topics in the Unix Linux Community
PHP Help with Form Submit
Perl grep
source ... how to initiate once in linux or php
Running php index.php as shell in webpage
Multidimensional array