首页 >函数列表 >token_get_all

token_get_all

token_get_all

(PHP 4 >= 4.2.0, PHP 5)

token_get_allSplit given source into PHP tokens

说明

array token_get_all ( string $source )

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.

参数

source

The PHP source to parse.

返回值

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.

范例

Example #1 token_get_all() examples

<?php
$tokens 
token_get_all('<?php echo; ?>'); 


$tokens token_get_all(''); // => array(array(T_INLINE_HTML, ''));
?>

更新日志

版本 说明
5.2.2 Line numbers are returned in element 2

  • token_get_all
  • token_name
  • PHP MySQL HTML CSS JavaScript MSSQL AJAX .NET JSP Linux Mac ASP 服务器 SQL jQuery C# C++ java Android IOS oracle MongoDB SQLite wamp 交通频道