关于安装百度谷歌都知道
一个简单的phptest程序,主要是看看opcode
<?php
class a {
const b = 1;
public $c = 2;
public function d(){
echo "hello abcd!\n";
}
}
$a = new a();
$a->d();
$b = new a();
echo $b->c;
//>
class a {
const b = 1;
public $c = 2;
public function d(){
echo "hello abcd!\n";
}
}
$a = new a();
$a->d();
$b = new a();
echo $b->c;
//>
[root@localhost ~]# php -dextension=vld.so -dvld.active=1 /usr/local/nginx/html/class.php
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename: /usr/local/nginx/html/class.php
function name: (null)
number of ops: 12
compiled vars: !0 = $a, !1 = $b
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
3 0 E > NOP
11 1 NEW $3 :-5
2 DO_FCALL 0
3 ASSIGN !0, $3
13 4 INIT_METHOD_CALL !0, 'd'
5 DO_FCALL 0
15 6 NEW $7 :-1
7 DO_FCALL 0
8 ASSIGN !1, $7
17 9 FETCH_OBJ_R $10 !1, 'c'
10 ECHO $10
20 11 > RETURN 1
branch: # 0; line: 3- 20; sop: 0; eop: 11; out0: -2
path #1: 0,
Class a:
Function d:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename: /usr/local/nginx/html/class.php
function name: d
number of ops: 2
compiled vars: none
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
7 0 E > ECHO 'hello+abcd%21%0A'
8 1 > RETURN null
branch: # 0; line: 7- 8; sop: 0; eop: 1; out0: -2
path #1: 0,
End of function d
End of class a.
hello abcd!
2
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename: /usr/local/nginx/html/class.php
function name: (null)
number of ops: 12
compiled vars: !0 = $a, !1 = $b
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
3 0 E > NOP
11 1 NEW $3 :-5
2 DO_FCALL 0
3 ASSIGN !0, $3
13 4 INIT_METHOD_CALL !0, 'd'
5 DO_FCALL 0
15 6 NEW $7 :-1
7 DO_FCALL 0
8 ASSIGN !1, $7
17 9 FETCH_OBJ_R $10 !1, 'c'
10 ECHO $10
20 11 > RETURN 1
branch: # 0; line: 3- 20; sop: 0; eop: 11; out0: -2
path #1: 0,
Class a:
Function d:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename: /usr/local/nginx/html/class.php
function name: d
number of ops: 2
compiled vars: none
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
7 0 E > ECHO 'hello+abcd%21%0A'
8 1 > RETURN null
branch: # 0; line: 7- 8; sop: 0; eop: 1; out0: -2
path #1: 0,
End of function d
End of class a.
hello abcd!
2
对照的可以看到每一行代码生成的opcode
转载请注明:小Y » php扩展vld试用