3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { public function testMethod() { if(method_exists(static::class, 'toBeOverwritten')) { var_dump('method overwritten'); } else { var_dump('method not overwritten'); } } public function toBeOverwritten(){} } class B extends A { public function callTestMethod() { $this->testMethod(); } } (new B)->callTestMethod();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hTQWO
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   24     0  E >   NEW                                                  $0      'B'
          1        DO_FCALL                                          0          
          2        INIT_METHOD_CALL                                             $0, 'callTestMethod'
          3        DO_FCALL                                          0          
          4      > RETURN                                                       1

Class A:
Function testmethod:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hTQWO
function name:  testMethod
number of ops:  14
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                                   'method_exists'
          1        FETCH_CLASS_NAME                                     ~0      
          2        SEND_VAL                                                     ~0
          3        SEND_VAL                                                     'toBeOverwritten'
          4        DO_ICALL                                             $1      
          5      > JMPZ                                                         $1, ->10
    8     6    >   INIT_FCALL                                                   'var_dump'
          7        SEND_VAL                                                     'method+overwritten'
          8        DO_ICALL                                                     
    7     9      > JMP                                                          ->13
   10    10    >   INIT_FCALL                                                   'var_dump'
         11        SEND_VAL                                                     'method+not+overwritten'
         12        DO_ICALL                                                     
   12    13    > > RETURN                                                       null

End of function testmethod

Function tobeoverwritten:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hTQWO
function name:  toBeOverwritten
number of ops:  1
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                       null

End of function tobeoverwritten

End of class A.

Class B:
Function calltestmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hTQWO
function name:  callTestMethod
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   20     0  E >   INIT_METHOD_CALL                                             'testMethod'
          1        DO_FCALL                                          0          
   21     2      > RETURN                                                       null

End of function calltestmethod

Function testmethod:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hTQWO
function name:  testMethod
number of ops:  14
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                                   'method_exists'
          1        FETCH_CLASS_NAME                                     ~0      
          2        SEND_VAL                                                     ~0
          3        SEND_VAL                                                     'toBeOverwritten'
          4        DO_ICALL                                             $1      
          5      > JMPZ                                                         $1, ->10
    8     6    >   INIT_FCALL                                                   'var_dump'
          7        SEND_VAL                                                     'method+overwritten'
          8        DO_ICALL                                                     
    7     9      > JMP                                                          ->13
   10    10    >   INIT_FCALL                                                   'var_dump'
         11        SEND_VAL                                                     'method+not+overwritten'
         12        DO_ICALL                                                     
   12    13    > > RETURN                                                       null

End of function testmethod

Function tobeoverwritten:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/hTQWO
function name:  toBeOverwritten
number of ops:  1
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   14     0  E > > RETURN                                                       null

End of function tobeoverwritten

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
129.32 ms | 483 KiB | 9 Q