3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { public function foo($str) { $this->foobar($str); } private function foobar(string $str) { print "A"; if ($str !== "A") { $this->foobar("A"); // does never call B::foobar, as foobar is private } } } class B extends A { public function foobar(string $str) { print "B"; parent::foo("B"); } } (new A)->foo("A"); print PHP_EOL . "---" . PHP_EOL; (new B)->foo("B");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KrOtJ
function name:  (null)
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $0      'A'
          1        DO_FCALL                                      0          
          2        INIT_METHOD_CALL                                         $0, 'foo'
          3        SEND_VAL_EX                                              'A'
          4        DO_FCALL                                      0          
   27     5        ECHO                                                     '%0A---%0A'
   29     6        NEW                                              $3      'B'
          7        DO_FCALL                                      0          
          8        INIT_METHOD_CALL                                         $3, 'foo'
          9        SEND_VAL_EX                                              'B'
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KrOtJ
function name:  foo
number of ops:  5
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_METHOD_CALL                                         'foobar'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
    6     4      > RETURN                                                   null

End of function foo

Function foobar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 7
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/KrOtJ
function name:  foobar
number of ops:  8
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
    9     1        ECHO                                                     'A'
   11     2        IS_NOT_IDENTICAL                                         !0, 'A'
          3      > JMPZ                                                     ~1, ->7
   12     4    >   INIT_METHOD_CALL                                         'foobar'
          5        SEND_VAL                                                 'A'
          6        DO_FCALL                                      0          
   14     7    > > RETURN                                                   null

End of function foobar

End of class A.

Class B:
Function foobar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KrOtJ
function name:  foobar
number of ops:  6
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        ECHO                                                     'B'
   21     2        INIT_STATIC_METHOD_CALL                                  'foo'
          3        SEND_VAL_EX                                              'B'
          4        DO_FCALL                                      0          
   22     5      > RETURN                                                   null

End of function foobar

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KrOtJ
function name:  foo
number of ops:  5
compiled vars:  !0 = $str
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
    5     1        INIT_METHOD_CALL                                         'foobar'
          2        SEND_VAR_EX                                              !0
          3        DO_FCALL                                      0          
    6     4      > RETURN                                                   null

End of function foo

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.45 ms | 1000 KiB | 13 Q