Skip to content

Instantly share code, notes, and snippets.

@c9s
Last active March 17, 2016 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save c9s/4a371df2192714155131 to your computer and use it in GitHub Desktop.
Save c9s/4a371df2192714155131 to your computer and use it in GitHub Desktop.
<?php
class A {
protected $bar;
public function getBar() {
return $this->bar;
}
}
$a = new A;
$bar = $a->getBar();
± % php -dvld.active=1 obj.php !14934
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename: /Users/c9s/src/php/explain/obj.php
function name: (null)
number of ops: 16
compiled vars: !0 = $a, !1 = $bar
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
2 0 E > EXT_STMT
1 NOP
12 2 EXT_STMT
3 FETCH_CLASS 0 :1 'A'
4 EXT_FCALL_BEGIN
5 NEW $2 :1
6 DO_FCALL_BY_NAME 0
7 EXT_FCALL_END
8 ASSIGN !0, $2
13 9 EXT_STMT
10 INIT_METHOD_CALL !0, 'getBar'
11 EXT_FCALL_BEGIN
12 DO_FCALL_BY_NAME 0 $6
13 EXT_FCALL_END
14 ASSIGN !1, $6
14 15 > RETURN 1
branch: # 0; line: 2- 14; sop: 0; eop: 15; out1: -2
path #1: 0,
Class A:
Function getbar:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename: /Users/c9s/src/php/explain/obj.php
function name: getBar
number of ops: 6
compiled vars: none
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
6 0 E > EXT_NOP
7 1 EXT_STMT
2 FETCH_OBJ_R $0 'bar'
3 > RETURN $0
8 4* EXT_STMT
5* > RETURN null
branch: # 0; line: 6- 8; sop: 0; eop: 5
path #1: 0,
End of function getbar
± % php -dvld.active=1 obj-public.php !14941
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename: /Users/c9s/src/php/explain/obj-public.php
function name: (null)
number of ops: 13
compiled vars: !0 = $a, !1 = $foo
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
2 0 E > EXT_STMT
1 NOP
6 2 EXT_STMT
3 FETCH_CLASS 0 :1 'A'
4 EXT_FCALL_BEGIN
5 NEW $2 :1
6 DO_FCALL_BY_NAME 0
7 EXT_FCALL_END
8 ASSIGN !0, $2
7 9 EXT_STMT
10 FETCH_OBJ_R $5 !0, 'foo'
11 ASSIGN !1, $5
8 12 > RETURN 1
branch: # 0; line: 2- 8; sop: 0; eop: 12; out1: -2
path #1: 0,
Class A: [no user functions]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment