3v4l.org

run code in 500+ PHP versions simultaneously
<?php $arr = array ( 0 => array ( 'number' => '2', 'name' => 'ABC', ), 1 => array ( 'number' => '3', 'name' => 'ABC', ), 2 => array ( 'number' => '1', 'name' => 'XYZ', ), 3 => array ( 'number' => '2', 'name' => 'XYZ', ), ); foreach($arr as $sub){ $res[$sub['name']]['name'] = $sub['name']; $res[$sub['name']]['number'][] = $sub['number']; } foreach($res as &$sub){ $sub['number'] = implode(",", $sub['number']); } $res = array_values($res); var_dump($res);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 15
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 15
2 jumps found. (Code = 125) Position 1 = 17, Position 2 = 23
Branch analysis from position: 17
2 jumps found. (Code = 126) Position 1 = 18, Position 2 = 23
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 23
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 15
filename:       /in/PbGsu
function name:  (null)
number of ops:  32
compiled vars:  !0 = $arr, !1 = $sub, !2 = $res
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
   26     1      > FE_RESET_R                                           $4      !0, ->15
          2    > > FE_FETCH_R                                                   $4, !1, ->15
   27     3    >   FETCH_DIM_R                                          ~5      !1, 'name'
          4        FETCH_DIM_R                                          ~8      !1, 'name'
          5        FETCH_DIM_W                                          $6      !2, ~5
          6        ASSIGN_DIM                                                   $6, 'name'
          7        OP_DATA                                                      ~8
   28     8        FETCH_DIM_R                                          ~9      !1, 'name'
          9        FETCH_DIM_R                                          ~13     !1, 'number'
         10        FETCH_DIM_W                                          $10     !2, ~9
         11        FETCH_DIM_W                                          $11     $10, 'number'
         12        ASSIGN_DIM                                                   $11
         13        OP_DATA                                                      ~13
   26    14      > JMP                                                          ->2
         15    >   FE_FREE                                                      $4
   31    16      > FE_RESET_RW                                          $14     !2, ->23
         17    > > FE_FETCH_RW                                                  $14, !1, ->23
   32    18    >   FETCH_DIM_R                                          ~16     !1, 'number'
         19        FRAMELESS_ICALL_2                implode             ~17     '%2C', ~16
         20        ASSIGN_DIM                                                   !1, 'number'
         21        OP_DATA                                                      ~17
   31    22      > JMP                                                          ->17
         23    >   FE_FREE                                                      $14
   34    24        INIT_FCALL                                                   'array_values'
         25        SEND_VAR                                                     !2
         26        DO_ICALL                                             $18     
         27        ASSIGN                                                       !2, $18
   35    28        INIT_FCALL                                                   'var_dump'
         29        SEND_VAR                                                     !2
         30        DO_ICALL                                                     
         31      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
162.4 ms | 2173 KiB | 15 Q