PHP代码执行步骤
PHP执行这段代码会经过如下4个步骤(确切的来说,应该是PHP的语言引擎Zend)
1.Scanning(Lexing) ,将PHP代码转换为语言片段(Tokens)
2.Parsing, 将Tokens转换成简单而有意义的表达式
3.Compilation, 将表达式编译成Opocdes
4.Execution, 顺次执行Opcodes,每次一条,从而实现PHP脚本的功能。
token_get_all()
将一段PHP代码 Scanning成Tokens;
var_dump(token_get_all('<?php echo "Hello World"; ?>'));
Array(
[0] => Array(
[0] => 376
[1] => <?php
[2] => 1 )
[1] => Array(
[0] => 319
[1] => echo
[2] => 1 )
[2] => Array(
[0] => 379
[1] =>
[2] => 1 )
[3] => Array(
[0] => 318
[1] => "Hello World"
[2] => 1 )
[4] => ;
[5] => Array(
[0] => 379
[1] =>
[2] => 1 )
[6] => Array(
[0] => 378
[1] => ?>
[2] => 1 )
)
相关推荐
zyyjay 2020-11-09
xuebingnan 2020-11-05
samtrue 2020-11-22
stefan0 2020-11-22
yifangs 2020-10-13
songshijiazuaa 2020-09-24
hebiwtc 2020-09-18
天步 2020-09-17
83911535 2020-11-13
whatsyourname 2020-11-13
zhouyuqi 2020-11-10
Noneyes 2020-11-10
mathchao 2020-10-28
王志龙 2020-10-28
wwwsurfphpseocom 2020-10-28
diskingchuan 2020-10-23
savorTheFlavor 2020-10-23