3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function testIsCallable(callable $param) { return is_callable($param); } private function privateMethod() { echo "This is a private method"; } public function test($param) { if ($this->testIsCallable($param)) { $param(); } } } class B extends A { public function test($param) { if ($this->testIsCallable($param)) { $param(); } } } $a = new A(); $b = new B(); $callable = [$a, 'privateMethod']; $a->test($callable); $b->test($callable);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qlsrm
function name:  (null)
number of ops:  16
compiled vars:  !0 = $a, !1 = $b, !2 = $callable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   NEW                                              $3      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $3
   30     3        NEW                                              $6      'B'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $6
   32     6        INIT_ARRAY                                       ~9      !0
          7        ADD_ARRAY_ELEMENT                                ~9      'privateMethod'
          8        ASSIGN                                                   !2, ~9
   34     9        INIT_METHOD_CALL                                         !0, 'test'
         10        SEND_VAR_EX                                              !2
         11        DO_FCALL                                      0          
   35    12        INIT_METHOD_CALL                                         !1, 'test'
         13        SEND_VAR_EX                                              !2
         14        DO_FCALL                                      0          
         15      > RETURN                                                   1

Class A:
Function testiscallable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qlsrm
function name:  testIsCallable
number of ops:  6
compiled vars:  !0 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'is_callable'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
    7     5*     > RETURN                                                   null

End of function testiscallable

Function privatemethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qlsrm
function name:  privateMethod
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ECHO                                                     'This+is+a+private+method'
   11     1      > RETURN                                                   null

End of function privatemethod

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/qlsrm
function name:  test
number of ops:  8
compiled vars:  !0 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   14     1        INIT_METHOD_CALL                                         'testIsCallable'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > JMPZ                                                     $1, ->7
   15     5    >   INIT_DYNAMIC_CALL                                        !0
          6        DO_FCALL                                      0          
   17     7    > > RETURN                                                   null

End of function test

End of class A.

Class B:
Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/qlsrm
function name:  test
number of ops:  8
compiled vars:  !0 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1        INIT_METHOD_CALL                                         'testIsCallable'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0  $1      
          4      > JMPZ                                                     $1, ->7
   24     5    >   INIT_DYNAMIC_CALL                                        !0
          6        DO_FCALL                                      0          
   26     7    > > RETURN                                                   null

End of function test

Function testiscallable:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qlsrm
function name:  testIsCallable
number of ops:  6
compiled vars:  !0 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_FCALL                                               'is_callable'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $1      
          4      > RETURN                                                   $1
    7     5*     > RETURN                                                   null

End of function testiscallable

Function privatemethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qlsrm
function name:  privateMethod
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   ECHO                                                     'This+is+a+private+method'
   11     1      > RETURN                                                   null

End of function privatemethod

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.32 ms | 1400 KiB | 15 Q