3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [['xxx', 3], ['yyy', 2]]; var_export( array_reduce( $array, fn($result, $row) => [...$result, ...array_fill(0, $row[1], [$row[0]])], [] ) );
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PI0Za
function name:  (null)
number of ops:  11
compiled vars:  !0 = $array
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    5     1        INIT_FCALL                                               'var_export'
    6     2        INIT_FCALL                                               'array_reduce'
    7     3        SEND_VAR                                                 !0
    8     4        DECLARE_LAMBDA_FUNCTION                          ~2      [0]
          5        SEND_VAL                                                 ~2
    9     6        SEND_VAL                                                 <array>
    6     7        DO_ICALL                                         $3      
    9     8        SEND_VAR                                                 $3
    5     9        DO_ICALL                                                 
   11    10      > 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/PI0Za
function name:  {closure}
number of ops:  15
compiled vars:  !0 = $result, !1 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        INIT_ARRAY                                       ~2      
          3        ADD_ARRAY_UNPACK                                 ~2      !0
          4        INIT_FCALL                                               'array_fill'
          5        SEND_VAL                                                 0
          6        FETCH_DIM_R                                      ~3      !1, 1
          7        SEND_VAL                                                 ~3
          8        FETCH_DIM_R                                      ~4      !1, 0
          9        INIT_ARRAY                                       ~5      ~4
         10        SEND_VAL                                                 ~5
         11        DO_ICALL                                         $6      
         12        ADD_ARRAY_UNPACK                                 ~2      $6
         13      > RETURN                                                   ~2
         14*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.21 ms | 1000 KiB | 16 Q