3v4l.org

run code in 300+ PHP versions simultaneously
<?php class MyClass {} function f() { $c = new MyClass(); $s = 'MyClass'; if ($c instanceof $s) { echo "yes1\n"; } else { echo "no1\n"; } $s = new stdClass(); $s->s = 'MyClass'; if ($c instanceof $s->s) { echo "yes2\n"; } else { echo "no2\n"; } $s = 'My'; if ($c instanceof $s.'Class') { // Not what you think -- ($c instanceof $s).'Class' echo "yes3\n"; } else { echo "no3\n"; } } f();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/s44m5
function name:  (null)
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   INIT_FCALL                                               'f'
          1        DO_FCALL                                      0          
          2      > RETURN                                                   1

Function f:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 22
Branch analysis from position: 22
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 29
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
2 jumps found. (Code = 43) Position 1 = 27, Position 2 = 29
Branch analysis from position: 27
Branch analysis from position: 29
Branch analysis from position: 9
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 21
Branch analysis from position: 19
Branch analysis from position: 21
filename:       /in/s44m5
function name:  f
number of ops:  31
compiled vars:  !0 = $c, !1 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   NEW                                              $2      'MyClass'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
    9     3        ASSIGN                                                   !1, 'MyClass'
   10     4        FETCH_CLASS                                   0  $6      !1
          5        INSTANCEOF                                               !0, $6
          6      > JMPZ                                                     ~7, ->9
   11     7    >   ECHO                                                     'yes1%0A'
          8      > JMP                                                      ->10
   13     9    >   ECHO                                                     'no1%0A'
   16    10    >   NEW                                              $8      'stdClass'
         11        DO_FCALL                                      0          
         12        ASSIGN                                                   !1, $8
   17    13        ASSIGN_OBJ                                               !1, 's'
         14        OP_DATA                                                  'MyClass'
   18    15        FETCH_OBJ_R                                      ~12     !1, 's'
         16        FETCH_CLASS                                   0  $13     ~12
         17        INSTANCEOF                                               !0, $13
         18      > JMPZ                                                     ~14, ->21
   19    19    >   ECHO                                                     'yes2%0A'
         20      > JMP                                                      ->22
   21    21    >   ECHO                                                     'no2%0A'
   25    22    >   ASSIGN                                                   !1, 'My'
   26    23        FETCH_CLASS                                   0  $16     !1
         24        INSTANCEOF                                       ~17     !0, $16
         25        CONCAT                                           ~18     ~17, 'Class'
         26      > JMPZ                                                     ~18, ->29
   27    27    >   ECHO                                                     'yes3%0A'
         28      > JMP                                                      ->30
   29    29    >   ECHO                                                     'no3%0A'
   31    30    > > RETURN                                                   null

End of function f

Class MyClass: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.22 ms | 948 KiB | 15 Q