3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arrays = [ [ "id" => 1, "order_id" => 1, "image_url" => "/resources/filename1" ], [ "id" => 2, "order_id" => 1, "image_url" => "/resources/filename2" ], [ "id" => 3, "order_id" => 1, "image_url" => "/resources/filename3" ], [ "id" => 4, "order_id" => 2, "image_url" => "/resources/filename4" ], ]; foreach($arrays as $array) { if(!isset($result[$array['order_id']]['id'])) { $result[$array['order_id']]['id']=$array['id']; } $result[$array['order_id']]['order_id']=$array['order_id']; $result[$array['order_id']]['image_url'][]=$array['image_url']; } print_r($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 25
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 25
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 13
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/Y25C2
function name:  (null)
number of ops:  30
compiled vars:  !0 = $arrays, !1 = $array, !2 = $result
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                       !0, <array>
   25     1      > FE_RESET_R                                           $4      !0, ->25
          2    > > FE_FETCH_R                                                   $4, !1, ->25
   26     3    >   FETCH_DIM_R                                          ~5      !1, 'order_id'
          4        FETCH_DIM_IS                                         ~6      !2, ~5
          5        ISSET_ISEMPTY_DIM_OBJ                             0  ~7      ~6, 'id'
          6        BOOL_NOT                                             ~8      ~7
          7      > JMPZ                                                         ~8, ->13
   27     8    >   FETCH_DIM_R                                          ~9      !1, 'order_id'
          9        FETCH_DIM_R                                          ~12     !1, 'id'
         10        FETCH_DIM_W                                          $10     !2, ~9
         11        ASSIGN_DIM                                                   $10, 'id'
         12        OP_DATA                                                      ~12
   29    13    >   FETCH_DIM_R                                          ~13     !1, 'order_id'
         14        FETCH_DIM_R                                          ~16     !1, 'order_id'
         15        FETCH_DIM_W                                          $14     !2, ~13
         16        ASSIGN_DIM                                                   $14, 'order_id'
         17        OP_DATA                                                      ~16
   30    18        FETCH_DIM_R                                          ~17     !1, 'order_id'
         19        FETCH_DIM_R                                          ~21     !1, 'image_url'
         20        FETCH_DIM_W                                          $18     !2, ~17
         21        FETCH_DIM_W                                          $19     $18, 'image_url'
         22        ASSIGN_DIM                                                   $19
         23        OP_DATA                                                      ~21
   25    24      > JMP                                                          ->2
         25    >   FE_FREE                                                      $4
   34    26        INIT_FCALL                                                   'print_r'
         27        SEND_VAR                                                     !2
         28        DO_ICALL                                                     
         29      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.32 ms | 2334 KiB | 14 Q