3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array( '0' => array( 'names' => array(0 => 'Apple'), 'group' => 1 ), '1' => array( 'names' => array(0 => 'Mango'), 'group' => 1 ), '2' => array( 'names' => array(0 => 'Grapes'), 'group' => 1 ), '3' => array( 'names' => array(0 => 'Tomato'), 'group' => 2 ), '4' => array( 'names' => array(0 => 'Potato', 1 => 'Monkeywrench'), 'group' => 2 ) ); foreach ($array as $row) { if (!isset($result[$row['group']])) { $result[$row['group']] = $row; } else { $result[$row['group']]['names'] = array_merge($result[$row['group']]['names'], $row['names']); } } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 24
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 24
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 11
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/r1ZLQ
function name:  (null)
number of ops:  32
compiled vars:  !0 = $array, !1 = $row, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   25     1      > FE_RESET_R                                       $4      !0, ->24
          2    > > FE_FETCH_R                                               $4, !1, ->24
   26     3    >   FETCH_DIM_R                                      ~5      !1, 'group'
          4        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !2, ~5
          5        BOOL_NOT                                         ~7      ~6
          6      > JMPZ                                                     ~7, ->11
   27     7    >   FETCH_DIM_R                                      ~8      !1, 'group'
          8        ASSIGN_DIM                                               !2, ~8
          9        OP_DATA                                                  !1
         10      > JMP                                                      ->23
   29    11    >   FETCH_DIM_R                                      ~10     !1, 'group'
         12        INIT_FCALL                                               'array_merge'
         13        FETCH_DIM_R                                      ~13     !1, 'group'
         14        FETCH_DIM_R                                      ~14     !2, ~13
         15        FETCH_DIM_R                                      ~15     ~14, 'names'
         16        SEND_VAL                                                 ~15
         17        FETCH_DIM_R                                      ~16     !1, 'names'
         18        SEND_VAL                                                 ~16
         19        DO_ICALL                                         $17     
         20        FETCH_DIM_W                                      $11     !2, ~10
         21        ASSIGN_DIM                                               $11, 'names'
         22        OP_DATA                                                  $17
   25    23    > > JMP                                                      ->2
         24    >   FE_FREE                                                  $4
   33    25        INIT_FCALL                                               'var_export'
         26        INIT_FCALL                                               'array_values'
         27        SEND_VAR                                                 !2
         28        DO_ICALL                                         $18     
         29        SEND_VAR                                                 $18
         30        DO_ICALL                                                 
         31      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.71 ms | 1400 KiB | 19 Q