3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ [ 'name' => 'filter_amount', 'value' => '100-ml' ], [ 'name' => 'filter_amount', 'value' => '200-ml' ], [ 'name' => 'page_size', 'value' => '7' ] ]; $result = []; foreach ($array as $row) { if (!isset($result[$row['name']])) { $result[$row['name']] = $row; } else { $result[$row['name']]['value'] .= ',' . $row['value']; } } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 19
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 19
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 12
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/rh5Lo
function name:  (null)
number of ops:  27
compiled vars:  !0 = $array, !1 = $result, !2 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   18     1        ASSIGN                                                   !1, <array>
   19     2      > FE_RESET_R                                       $5      !0, ->19
          3    > > FE_FETCH_R                                               $5, !2, ->19
   20     4    >   FETCH_DIM_R                                      ~6      !2, 'name'
          5        ISSET_ISEMPTY_DIM_OBJ                         0  ~7      !1, ~6
          6        BOOL_NOT                                         ~8      ~7
          7      > JMPZ                                                     ~8, ->12
   21     8    >   FETCH_DIM_R                                      ~9      !2, 'name'
          9        ASSIGN_DIM                                               !1, ~9
         10        OP_DATA                                                  !2
         11      > JMP                                                      ->18
   23    12    >   FETCH_DIM_R                                      ~11     !2, 'name'
         13        FETCH_DIM_R                                      ~14     !2, 'value'
         14        CONCAT                                           ~15     '%2C', ~14
         15        FETCH_DIM_RW                                     $12     !1, ~11
         16        ASSIGN_DIM_OP                .=               8          $12, 'value'
         17        OP_DATA                                                  ~15
   19    18    > > JMP                                                      ->3
         19    >   FE_FREE                                                  $5
   26    20        INIT_FCALL                                               'var_export'
         21        INIT_FCALL                                               'array_values'
         22        SEND_VAR                                                 !1
         23        DO_ICALL                                         $16     
         24        SEND_VAR                                                 $16
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.9 ms | 1401 KiB | 17 Q