3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { function test() { echo $this instanceof B ? 'B' : 'A'; } } class B extends A { } $b = new B; $b->test();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2j965
function name:  (null)
number of ops:  6
compiled vars:  !0 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   NEW                                              $1      'B'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   13     3        INIT_METHOD_CALL                                         !0, 'test'
          4        DO_FCALL                                      0          
          5      > RETURN                                                   1

Class A:
Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2j965
function name:  test
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_THIS                                       ~0      
          1        INSTANCEOF                                               ~0, 'B'
          2      > JMPZ                                                     ~1, ->5
          3    >   QM_ASSIGN                                        ~2      'B'
          4      > JMP                                                      ->6
          5    >   QM_ASSIGN                                        ~2      'A'
          6    >   ECHO                                                     ~2
    6     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 = 3, Position 2 = 5
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2j965
function name:  test
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   FETCH_THIS                                       ~0      
          1        INSTANCEOF                                               ~0, 'B'
          2      > JMPZ                                                     ~1, ->5
          3    >   QM_ASSIGN                                        ~2      'B'
          4      > JMP                                                      ->6
          5    >   QM_ASSIGN                                        ~2      'A'
          6    >   ECHO                                                     ~2
    6     7      > RETURN                                                   null

End of function test

End of class B.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.81 ms | 1395 KiB | 13 Q