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 { array_push($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 = 21
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 21
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 = 20
Branch analysis from position: 20
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: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
filename:       /in/rF6IC
function name:  (null)
number of ops:  29
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, ->21
          2    > > FE_FETCH_R                                               $4, !1, ->21
   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                                                      ->20
   29    11    >   INIT_FCALL                                               'array_push'
         12        FETCH_DIM_R                                      ~10     !1, 'group'
         13        FETCH_DIM_W                                      $11     !2, ~10
         14        FETCH_DIM_W                                      $12     $11, 'names'
         15        SEND_REF                                                 $12
         16        FETCH_DIM_R                                      ~13     !1, 'names'
         17        SEND_UNPACK                                              ~13
         18        CHECK_UNDEF_ARGS                                         
         19        DO_ICALL                                                 
   25    20    > > JMP                                                      ->2
         21    >   FE_FREE                                                  $4
   33    22        INIT_FCALL                                               'var_export'
         23        INIT_FCALL                                               'array_values'
         24        SEND_VAR                                                 !2
         25        DO_ICALL                                         $15     
         26        SEND_VAR                                                 $15
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
214.49 ms | 1400 KiB | 19 Q