3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['term_title' => 'black'], ['color_quantity' => 2], ['color_price' => 22], ['term_title' => 'blue'], ['color_quantity' => 3], ['color_price' => 33], ]; foreach ($array as $index => $subarray) { $key = key($subarray); $result[intdiv($index, 3)][$key] = $subarray[$key]; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 17
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 17
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
filename:       /in/WL44T
function name:  (null)
number of ops:  22
compiled vars:  !0 = $array, !1 = $subarray, !2 = $index, !3 = $key, !4 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   12     1      > FE_RESET_R                                       $6      !0, ->17
          2    > > FE_FETCH_R                                       ~7      $6, !1, ->17
          3    >   ASSIGN                                                   !2, ~7
   13     4        INIT_FCALL                                               'key'
          5        SEND_VAR                                                 !1
          6        DO_ICALL                                         $9      
          7        ASSIGN                                                   !3, $9
   14     8        INIT_FCALL                                               'intdiv'
          9        SEND_VAR                                                 !2
         10        SEND_VAL                                                 3
         11        DO_ICALL                                         $11     
         12        FETCH_DIM_R                                      ~14     !1, !3
         13        FETCH_DIM_W                                      $12     !4, $11
         14        ASSIGN_DIM                                               $12, !3
         15        OP_DATA                                                  ~14
   12    16      > JMP                                                      ->2
         17    >   FE_FREE                                                  $6
   16    18        INIT_FCALL                                               'var_export'
         19        SEND_VAR                                                 !4
         20        DO_ICALL                                                 
         21      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.91 ms | 1400 KiB | 19 Q