3v4l.org

run code in 300+ PHP versions simultaneously
<?php $types = array( "text" => 2, "image" => 2, "audio" => 2, ); $output = []; foreach ($types as $item => $num) { for ($i = 0; $i < $num; ++$i) { $output[$i][] = $item; } } $output = array_merge(...$output); print_r($output);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 14
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 7
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 7
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 7
Branch analysis from position: 13
Branch analysis from position: 7
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/cL20Z
function name:  (null)
number of ops:  24
compiled vars:  !0 = $types, !1 = $output, !2 = $num, !3 = $item, !4 = $i
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   11     2      > FE_RESET_R                                       $7      !0, ->14
          3    > > FE_FETCH_R                                       ~8      $7, !2, ->14
          4    >   ASSIGN                                                   !3, ~8
   12     5        ASSIGN                                                   !4, 0
          6      > JMP                                                      ->11
   13     7    >   FETCH_DIM_W                                      $11     !1, !4
          8        ASSIGN_DIM                                               $11
          9        OP_DATA                                                  !3
   12    10        PRE_INC                                                  !4
         11    >   IS_SMALLER                                               !4, !2
         12      > JMPNZ                                                    ~14, ->7
   11    13    > > JMP                                                      ->3
         14    >   FE_FREE                                                  $7
   17    15        INIT_FCALL                                               'array_merge'
         16        SEND_UNPACK                                              !1
         17        CHECK_UNDEF_ARGS                                         
         18        DO_ICALL                                         $15     
         19        ASSIGN                                                   !1, $15
   19    20        INIT_FCALL                                               'print_r'
         21        SEND_VAR                                                 !1
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.5 ms | 999 KiB | 15 Q