位置: 编程技术 - 正文
推荐整理分享PHP:token_get_all()的用法_Tokenizer函数,希望有所帮助,仅作参考,欢迎阅读内容。
文章相关热门搜索词:,内容如对您有帮助,希望把文章链接给更多的朋友!
(PHP 4 >= 4.2.0, PHP 5)
token_get_all — 将提供的源码按 PHP 标记进行分割
说明 array token_get_all ( string $source )token_get_all() 解析提供的 source 源码字符,然后使用 Zend 引擎的语法分析器获取源码中的 PHP 语言的解析器代号
解析器代号列表见解析器代号列表, 或者使用 token_name() 翻译获取这个代号的字符串表示.
参数source
需要解析的 PHP 源码.
返回值An array of token identifiers. Each individual token identifier is either a single character (i.e.: ;, ., 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('<?phpecho;?>');/*=>array(array(T_OPEN_TAG,'<?php'),array(T_ECHO,'echo'),';',array(T_CLOSE_TAG,'?>'));*//*NoteinthefollowingexamplethatthestringisparsedasT_INLINE_HTMLratherthantheotherwiseexpectedT_COMMENT(T_ML_COMMENTinPHP<5).Thisisbecausenoopen/closetagswereusedinthe"code"provided.Thiswouldbeequivalenttoputtingacommentoutsideof<?php?>tagsinanormalfile.*/$tokens=token_get_all('/*comment*/');//=>array(array(T_INLINE_HTML,'/*comment*/'));?> 更新日志版本 说明 5.2.2 Line numbers are returned in element 2
PHP:token_name()的用法_Tokenizer函数 token_name(PHP4=4.2.0,PHP5)token_name获取提供的PHP解析器代号的符号名称说明stringtoken_name(int$token)token_name()获取一个PHPtoken的符号名称.参数token解析器代号的值.
PHP:stream_register_wrapper()的用法_Stream函数 stream_register_wrapper(PHP4=4.3.0,PHP5)stream_register_wrapper注册一个用PHP类实现的URL封装协议说明booleanstream_register_wrapper(string$protocol,string$classname)stream_register_wrappe
PHP:stream_socket_pair()的用法_Stream函数 stream_socket_pair(PHP5=5.1.0)stream_socket_pair创建一对完全一样的网络套接字连接流说明arraystream_socket_pair(int$domain,int$type,int$protocol)stream_socket_pair()创建一对完全
标签: PHP:token_get_all()的用法_Tokenizer函数
本文链接地址:https://www.jiuchutong.com/biancheng/280587.html 转载请保留说明!上一篇:PHP:base64_decode()的用法_url函数
下一篇:PHP:token_name()的用法_Tokenizer函数
友情链接: 武汉网站建设