3v4l.org

run code in 300+ PHP versions simultaneously
<?php $stores = ['store1', 'store2']; $items = [ 'electronics' => 'led tv', 'cosmetics' => 'eyeliner', 'fruits' => 'apple', 'vegetables' => 'cabbage', ]; var_export( array_reduce( $stores, fn($result, $s) => $result + [$s => $items + ['store' => $s]], [] ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JtnrL
function name:  (null)
number of ops:  13
compiled vars:  !0 = $stores, !1 = $items
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        ASSIGN                                                   !1, <array>
   12     2        INIT_FCALL                                               'var_export'
   13     3        INIT_FCALL                                               'array_reduce'
   14     4        SEND_VAR                                                 !0
   15     5        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
          6        BIND_LEXICAL                                             ~4, !1
          7        SEND_VAL                                                 ~4
   16     8        SEND_VAL                                                 <array>
   13     9        DO_ICALL                                         $5      
   16    10        SEND_VAR                                                 $5
   12    11        DO_ICALL                                                 
   18    12      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JtnrL
function name:  {closure}
number of ops:  9
compiled vars:  !0 = $result, !1 = $s, !2 = $items
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        INIT_ARRAY                                       ~3      !1, 'store'
          4        ADD                                              ~4      !2, ~3
          5        INIT_ARRAY                                       ~5      ~4, !1
          6        ADD                                              ~6      !0, ~5
          7      > RETURN                                                   ~6
          8*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.97 ms | 1011 KiB | 15 Q