3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo {} class Bar {} function test($value) { var_dump(match (true) { $value instanceof Foo => 'Foo', $value instanceof Bar => 'Bar', }); } test(new Foo()); test(new Bar());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/stkDM
function name:  (null)
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'test'
          1        NEW                                              $0      'Foo'
          2        DO_FCALL                                      0          
          3        SEND_VAR                                                 $0
          4        DO_FCALL                                      0          
   14     5        INIT_FCALL                                               'test'
          6        NEW                                              $3      'Bar'
          7        DO_FCALL                                      0          
          8        SEND_VAR                                                 $3
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 197) Position 1 = -2
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
filename:       /in/stkDM
function name:  test
number of ops:  17
compiled vars:  !0 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
    7     1        INIT_FCALL                                               'var_dump'
    8     2        INSTANCEOF                                       ~2      !0, 'Foo'
          3        IS_IDENTICAL                                             ~2, <true>
          4      > JMPNZ                                                    ~1, ->10
    9     5    >   INSTANCEOF                                       ~3      !0, 'Bar'
          6        IS_IDENTICAL                                             ~3, <true>
          7      > JMPNZ                                                    ~1, ->12
          8    > > JMP                                                      ->9
          9    > > MATCH_ERROR                                              <true>
    8    10    >   QM_ASSIGN                                        ~4      'Foo'
         11      > JMP                                                      ->14
    9    12    >   QM_ASSIGN                                        ~4      'Bar'
         13      > JMP                                                      ->14
         14    >   SEND_VAL                                                 ~4
         15        DO_ICALL                                                 
   11    16      > RETURN                                                   null

End of function test

Class Foo: [no user functions]
Class Bar: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.41 ms | 1399 KiB | 17 Q