3v4l.org

run code in 300+ PHP versions simultaneously
<?php $mode[1] = [1, 2, 5, 6]; $mode[0] = [3, 4, 7, 8]; var_export( array_reduce( array_keys($mode), fn($result, $k) => $result += array_fill_keys($mode[$k], $k), [] ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/043tB
function name:  (null)
number of ops:  18
compiled vars:  !0 = $mode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN_DIM                                               !0, 1
          1        OP_DATA                                                  <array>
    4     2        ASSIGN_DIM                                               !0, 0
          3        OP_DATA                                                  <array>
    6     4        INIT_FCALL                                               'var_export'
    7     5        INIT_FCALL                                               'array_reduce'
    8     6        INIT_FCALL                                               'array_keys'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $3      
          9        SEND_VAR                                                 $3
    9    10        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2F043tB%3A9%240'
         11        BIND_LEXICAL                                             ~4, !0
         12        SEND_VAL                                                 ~4
   10    13        SEND_VAL                                                 <array>
         14        DO_ICALL                                         $5      
         15        SEND_VAR                                                 $5
         16        DO_ICALL                                                 
   12    17      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2F043tB%3A9%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/043tB
function name:  {closure}
number of ops:  11
compiled vars:  !0 = $result, !1 = $k, !2 = $mode
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        INIT_FCALL                                               'array_fill_keys'
          4        FETCH_DIM_R                                      ~3      !2, !1
          5        SEND_VAL                                                 ~3
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $4      
          8        ASSIGN_OP                                     1  ~5      !0, $4
          9      > RETURN                                                   ~5
         10*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2F043tB%3A9%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
149.42 ms | 1400 KiB | 21 Q