token_get_all

(PHP 4 >= 4.2.0, PHP 5)

token_get_all — Split given source into PHP toke

说明

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.

参数

sourceThe 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

=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 */'));?>

更新日志

版本

说明

5.2.2

Line numbers are returned in element 2

—-想了解更多的php相关异常处理怎么解决关注

本文来自网络收集,不代表猴子技术宅立场,如涉及侵权请点击右边联系管理员删除。

如若转载,请注明出处:https://www.ssfiction.com/phpjc/83843.html

tokengetall php,token_get_all Split given source into PHP tokens php函数分享相关推荐

  1. python3中find函数的用法_Python3正则匹配re.split,re.finditer及re.findall函数用法详解...

    本文实例讲述了Python3正则匹配re.split,re.finditer及re.findall函数用法.分享给大家供大家参考,具体如下: re.split re.finditer re.finda ...

  2. Source Insight 4怎么取消函数结束提示字符

    问题: source insight4 函数结束提示符 怎么取消?太丑了... 解决: Options -> Preferences -> Syntax Decorations -> ...

  3. source insight 4.0 代码函数变量符号高亮

    用source insight 看代码比较方便,怎么打开代码高亮提示功能??提高代码阅读效率.之前我们是用快捷键F8.现在我们可以通过配置source insight更加方便实现这个功能. 按F8后效 ...

  4. Javaweb学习笔记(JSP标准标签库)

    Javaweb学习笔记(JSP标准标签库) JSTL入门 安装和测试JSTL JSTL中的Core标签库 < c:out>标签 标签 标签 < c:catch>标签 标签 标签 ...

  5. java split函数报错

    执行如下的代码 public class App {public static void main(String[] args) {String str = "123+456+712&quo ...

  6. Python中关于split和splitext的差别和运用

    在使用Python的过程中,在处理字符串的时候会遇到split()和os.path.splitext()两个函数,他们的主要区别可以概括为一个从前往后搜索字符串,后者则是从后往前搜索 '.'(reve ...

  7. java诡异的String.split()方法

    Reference https://docs.oracle.com/javase/7/docs/api/java/lang/String.html#split(java.lang.String) 正文 ...

  8. python中split的用法取第二个分片_python中split()函数的用法

    函数:split() Python中有split()和os.path.split()两个函数,具体作用如下: split():拆分字符串.通过指定分隔符对字符串进行切片,并返回分割后的字符串列表(li ...

  9. 给Source Insight做个外挂系列之一--发现Source Insight

    作者:星轨(oRbIt)   E_Mail :inte2000@163.com 一提到外挂程序,大家肯定都不陌生,QQ就有很多个版本的去广告外挂,很多游戏也有用于扩展功能或者作弊的工具,其中很多也是以 ...

最新文章

  1. 单片机怎么学?新手怎么快速学会单片机?
  2. pythondocx模板_python操作docx文档(转)
  3. P1133 教主的花园
  4. 用NanoPi neo制作网络音箱了解一下?
  5. [机器学习-数学] 矩阵求导(分母布局与分子布局),以及常用的矩阵求导公式
  6. 通过资源名称得到资源id
  7. 如何枚举String类型的枚举?
  8. 常用sql server 语句
  9. 用URL传值的浏览器最大长度限制
  10. 接口性能测试方案分析
  11. 夏普利值:全排列边际效益的平均
  12. SketchUp2020下载SketchUp2020下载安装SketchUp草图大师2020下载安装详细教程
  13. 自适应盲信号处理的经典
  14. 简练网软考知识点整理-项目风险应对策略
  15. 世界著名管理定律:管人用人育人留人定律
  16. CentOS7安装Chrome浏览器
  17. ubuntu18打开网页慢的问题
  18. oracle 01405 提取的值为null,ORA-01405 : fetched column value is NULL
  19. 【Linux】IFS是个什么鬼
  20. nod-1631-小鲨鱼在51nod小学

热门文章

  1. 计算机网络8832,2021年4月份自学考试计算机网络原理04741答案.doc
  2. visio网络拓扑图_人才测评模型是什么?5步了解好看模型图
  3. 成为百万富翁的25种方法
  4. QQ音乐首发“无缝播放”新功能 音乐流媒体平台陆续上线
  5. 京东发布虎年春晚互动攻略 春晚联名款金碗套装首次曝光
  6. 蓝色起源8月25日进行无人飞行,携带实验设备等上天
  7. 我年薪百万,孩子教育花掉一半
  8. 四部门对蚂蚁集团提出整改要求,蚂蚁集团:已立即着手制定整改方案
  9. 给还是不给?又一个国家要求苹果必须为iPhone 12提供充电器
  10. 联想90W快充是假的吗?官方回应:我们不玩文字游戏