3v4l.org

run code in 500+ PHP versions simultaneously
<?php interface I {} class A implements I {} class B implements I {} $a = new A(); function doWork(I $i) { $carry = []; // from array_reduce, not relevant [$key, $value] = match (true) { $i instanceof A => ['a', []], // default is not handled //true => ['oops', []], }; $carry[$key] = $value; return $carry; } var_dump(doWork($a));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KrlXs
function name:  (null)
number of ops:  12
compiled vars:  !0 = $a
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   DECLARE_CLASS                                                'a'
    6     1        DECLARE_CLASS                                                'b'
    8     2        NEW                                                  $1      'A'
          3        DO_FCALL                                          0          
          4        ASSIGN                                                       !0, $1
   22     5        INIT_FCALL                                                   'var_dump'
          6        INIT_FCALL                                                   'dowork'
          7        SEND_VAR                                                     !0
          8        DO_FCALL                                          0  $4      
          9        SEND_VAR                                                     $4
         10        DO_ICALL                                                     
         11      > RETURN                                                       1

Function dowork:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
1 jumps found. (Code = 197) Position 1 = -2
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/KrlXs
function name:  doWork
number of ops:  18
compiled vars:  !0 = $i, !1 = $carry, !2 = $key, !3 = $value
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   10     0  E >   RECV                                                 !0      
   12     1        ASSIGN                                                       !1, <array>
   14     2        INSTANCEOF                                           ~6      !0, 'A'
          3        IS_IDENTICAL                                                 ~6, <true>
          4      > JMPNZ                                                        ~5, ->7
          5    > > JMP                                                          ->6
          6    > > MATCH_ERROR                                                  <true>
          7    >   QM_ASSIGN                                            ~7      <array>
          8      > JMP                                                          ->9
          9    >   FETCH_LIST_R                                         $8      ~7, 0
   13    10        ASSIGN                                                       !2, $8
         11        FETCH_LIST_R                                         $10     ~7, 1
         12        ASSIGN                                                       !3, $10
         13        FREE                                                         ~7
   18    14        ASSIGN_DIM                                                   !1, !2
         15        OP_DATA                                                      !3
   19    16      > RETURN                                                       !1
   20    17*     > RETURN                                                       null

End of function dowork

Class I: [no user functions]
Class A: [no user functions]
Class B: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
133.72 ms | 481 KiB | 9 Q