From b400f6c6b7e115c431f24f651973ef25dcfaa8c4 Mon Sep 17 00:00:00 2001 From: Mehdi Achour Date: Sun, 2 Jan 2005 12:20:10 +0000 Subject: [PATCH] switch ref.token to the new structure git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@176286 c90b9560-bf6c-de11-be94-00142212c4b1 --- .../tokenizer/functions/token-get-all.xml | 105 +++++++++++------- reference/tokenizer/functions/token-name.xml | 93 ++++++++++------ 2 files changed, 127 insertions(+), 71 deletions(-) diff --git a/reference/tokenizer/functions/token-get-all.xml b/reference/tokenizer/functions/token-get-all.xml index a18ce76f70..05e2d0dda7 100644 --- a/reference/tokenizer/functions/token-get-all.xml +++ b/reference/tokenizer/functions/token-get-all.xml @@ -1,53 +1,78 @@ - - - - token_get_all - Split given source into PHP tokens - - - Description - - arraytoken_get_all - stringsource - - - token_get_all parses the given source - string into PHP language tokens using the Zend engine's lexical scanner. - The function returns an array of token identifiers. Each individual token - identifier is either a single character (i.e.: ;, - ., >, !, etc...), - or a two element array containing the token index in element 0, and the string - content of the original token in element 1. - - - For a list of parser tokens, see , or use - token_name to translate a token value into its string - representation. - - - <function>token_get_all</function> examples - + + + + token_get_all + Split given source into PHP tokens + + + &reftitle.description; + + arraytoken_get_all + stringsource + + + token_get_all parses the given source + 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. + + + + &reftitle.parameters; + + + + source + + + The PHP source to parse. + + + + + + + + &reftitle.returnvalues; + + An array of token identifiers. Each individual token identifier is either + a single character (i.e.: ;, ., + >, !, etc...), + or a two element array containing the token index in element 0, and the string + content of the original token in element 1. + + + + &reftitle.examples; + + + <function>token_get_all</function> examples + array(array(T_OPEN_TAG, ''); /* => array( - array(T_OPEN_TAG, '') ); */ +$tokens = token_get_all(' array(array(T_OPEN_TAG, ''); /* => array( + array(T_OPEN_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 tags in a normal file. */ - $tokens = token_get_all('/* comment */'); // => array(array(T_INLINE_HTML, '/* comment */')); +$tokens = token_get_all('/* comment */'); // => array(array(T_INLINE_HTML, '/* comment */')); ?> ]]> - - - - + + + + + - - - token_name - Get the symbolic name of a given PHP token - - - Description - - stringtoken_name - inttoken - - - token_name returns the symbolic name for a PHP - token value. The symbolic name - returned matches the name of the matching token constant. - - - <function>token_name</function> example - + + + + token_name + Get the symbolic name of a given PHP token + + + &reftitle.description; + + stringtoken_name + inttoken + + + token_name gets the symbolic name for a PHP + token value. + + + + &reftitle.parameters; + + + + token + + + The token value. + + + + + + + + &reftitle.returnvalues; + + The symbolic name of the given token. The returned + name returned matches the name of the matching token constant. + + + + &reftitle.examples; + + + <function>token_name</function> example + "T_REQUIRE" +// 260 is the token value for the T_REQUIRE token +echo token_name(260); // -> "T_REQUIRE" - // a token constant maps to its own name - echo token_name(T_FUNCTION); // -> "T_FUNCTION" +// a token constant maps to its own name +echo token_name(T_FUNCTION); // -> "T_FUNCTION" ?> ]]> - - - - See also List of Parser Tokens. - - - + + + + + + &reftitle.seealso; + + + List of Parser Tokens + + + +