3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['id' => 1, 'date_inserted' => '2020-09-06', 'marketplace' => 'Etsy', 'total_stickers' => 11, 'total_orders' => 8, 'total_value' => 41.619999999999997], ['id' => 2, 'date_inserted' => '2020-09-06', 'marketplace' => 'Woo', 'total_stickers' => 2, 'total_orders' => 1, 'total_value' => 7.9800000000000004], ['id' => 3, 'date_inserted' => '2020-09-06', 'marketplace' => 'eBay', 'total_stickers' => 44, 'total_orders' => 40, 'total_value' => 115.63], ['id' => 4, 'date_inserted' => '2020-09-07', 'marketplace' => 'Etsy', 'total_stickers' => 8, 'total_orders' => 4, 'total_value' => 34.920000000000002], ['id' => 5, 'date_inserted' => '2020-09-07', 'marketplace' => 'Woo', 'total_stickers' => 9, 'total_orders' => 3, 'total_value' => '52.90'], ['id' => 6, 'date_inserted' => '2020-09-07', 'marketplace' => 'eBay', 'total_stickers' => 23, 'total_orders' => 21, 'total_value' => 58.030000000000001] ]; $result = []; foreach ($array as $row) { $level1 = $row['date_inserted']; $level2 = $row['marketplace']; unset($row['date_inserted'], $row['marketplace']); $result[$level1][$level2] = $row; } var_export($result);
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 = 3
Branch analysis from position: 3
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/PBAc7
function name:  (null)
number of ops:  19
compiled vars:  !0 = $array, !1 = $result, !2 = $row, !3 = $level1, !4 = $level2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   12     1        ASSIGN                                                   !1, <array>
   13     2      > FE_RESET_R                                       $7      !0, ->14
          3    > > FE_FETCH_R                                               $7, !2, ->14
   14     4    >   FETCH_DIM_R                                      ~8      !2, 'date_inserted'
          5        ASSIGN                                                   !3, ~8
   15     6        FETCH_DIM_R                                      ~10     !2, 'marketplace'
          7        ASSIGN                                                   !4, ~10
   16     8        UNSET_DIM                                                !2, 'date_inserted'
          9        UNSET_DIM                                                !2, 'marketplace'
   17    10        FETCH_DIM_W                                      $12     !1, !3
         11        ASSIGN_DIM                                               $12, !4
         12        OP_DATA                                                  !2
   13    13      > JMP                                                      ->3
         14    >   FE_FREE                                                  $7
   19    15        INIT_FCALL                                               'var_export'
         16        SEND_VAR                                                 !1
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.85 ms | 997 KiB | 14 Q