Skip to content

Instantly share code, notes, and snippets.

@c9s
Last active March 18, 2016 08:23
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/227edbaca1d52b63cd91 to your computer and use it in GitHub Desktop.
Save c9s/227edbaca1d52b63cd91 to your computer and use it in GitHub Desktop.
<?php
interface Intf {
public function getA();
}
class MyFoo implements Intf {
public $a;
public function getA() {
return $this->a;
}
}
function get(Intf $anyIntf) {
return $anyIntf->getA();
}
get(new MyFoo);
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename: /Users/c9s/src/php/explain/obj-poly.php
function name: (null)
number of ops: 11
compiled vars: none
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
2 0 E > NOP
6 1 DECLARE_CLASS $1 '%00myfoo%2FUsers%2Fc9s%2Fsrc%2Fphp%2Fexplain%2Fobj-poly.php0x10f0ca043', 'myfoo'
2 ADD_INTERFACE $1, 'Intf'
11 3 VERIFY_ABSTRACT_CLASS $1
13 4 NOP
17 5 FETCH_CLASS 0 :2 'MyFoo'
6 NEW $3 :2
7 DO_FCALL_BY_NAME 0
8 SEND_VAR_NO_REF 2 $3
9 DO_FCALL 1 'get'
18 10 > RETURN 1
branch: # 0; line: 2- 18; sop: 0; eop: 10; out1: -2
path #1: 0,
Function get:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename: /Users/c9s/src/php/explain/obj-poly.php
function name: get
number of ops: 5
compiled vars: !0 = $anyIntf
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
13 0 E > RECV !0
14 1 INIT_METHOD_CALL !0, 'getA'
2 DO_FCALL_BY_NAME 0 $1
3 > RETURN $1
15 4* > RETURN null
branch: # 0; line: 13- 15; sop: 0; eop: 4
path #1: 0,
End of function get
Class Intf:
Function geta:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename: /Users/c9s/src/php/explain/obj-poly.php
function name: getA
number of ops: 2
compiled vars: none
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
3 0 E > RAISE_ABSTRACT_ERROR
1 > RETURN null
branch: # 0; line: 3- 3; sop: 0; eop: 1; out1: -2
path #1: 0,
End of function geta
End of class Intf.
Class MyFoo:
Function geta:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename: /Users/c9s/src/php/explain/obj-poly.php
function name: getA
number of ops: 3
compiled vars: none
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
9 0 E > FETCH_OBJ_R $0 'a'
1 > RETURN $0
10 2* > RETURN null
branch: # 0; line: 9- 10; sop: 0; eop: 2
path #1: 0,
End of function geta
End of class MyFoo.
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename: /Users/c9s/src/php/explain/obj-poly.php
function name: (null)
number of ops: 19
compiled vars: none
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
2 0 E > EXT_STMT
1 NOP
6 2 EXT_STMT
3 DECLARE_CLASS $1 '%00myfoo%2FUsers%2Fc9s%2Fsrc%2Fphp%2Fexplain%2Fobj-poly.php0x107fd0043', 'myfoo'
4 ADD_INTERFACE $1, 'Intf'
11 5 VERIFY_ABSTRACT_CLASS $1
13 6 EXT_STMT
7 NOP
17 8 EXT_STMT
9 EXT_FCALL_BEGIN
10 FETCH_CLASS 0 :2 'MyFoo'
11 EXT_FCALL_BEGIN
12 NEW $3 :2
13 DO_FCALL_BY_NAME 0
14 EXT_FCALL_END
15 SEND_VAR_NO_REF 2 $3
16 DO_FCALL 1 'get'
17 EXT_FCALL_END
18 18 > RETURN 1
Function get:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename: /Users/c9s/src/php/explain/obj-poly.php
function name: get
number of ops: 10
compiled vars: !0 = $anyIntf
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
13 0 E > EXT_NOP
1 RECV !0
14 2 EXT_STMT
3 INIT_METHOD_CALL !0, 'getA'
4 EXT_FCALL_BEGIN
5 DO_FCALL_BY_NAME 0 $1
6 EXT_FCALL_END
7 > RETURN $1
15 8* EXT_STMT
9* > RETURN null
End of function get
Class Intf:
Function geta:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename: /Users/c9s/src/php/explain/obj-poly.php
function name: getA
number of ops: 4
compiled vars: none
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
3 0 E > EXT_NOP
1 RAISE_ABSTRACT_ERROR
2 EXT_STMT
3 > RETURN null
End of function geta
End of class Intf.
Class MyFoo:
Function geta:
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename: /Users/c9s/src/php/explain/obj-poly.php
function name: getA
number of ops: 6
compiled vars: none
line #* E I O op fetch ext return operands
-------------------------------------------------------------------------------------
8 0 E > EXT_NOP
9 1 EXT_STMT
2 FETCH_OBJ_R $0 'a'
3 > RETURN $0
10 4* EXT_STMT
5* > RETURN null
End of function geta
End of class MyFoo.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment