3v4l.org

run code in 300+ 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 = 26
Branch analysis from position: 17
2 jumps found. (Code = 126) Position 1 = 18, Position 2 = 26
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 17
Branch analysis from position: 17
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
Branch analysis from position: 15
filename:       /in/PbGsu
function name:  (null)
number of ops:  35
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, ->26
         17    > > FE_FETCH_RW                                              $14, !1, ->26
   32    18    >   INIT_FCALL                                               'implode'
         19        SEND_VAL                                                 '%2C'
         20        FETCH_DIM_R                                      ~16     !1, 'number'
         21        SEND_VAL                                                 ~16
         22        DO_ICALL                                         $17     
         23        ASSIGN_DIM                                               !1, 'number'
         24        OP_DATA                                                  $17
   31    25      > JMP                                                      ->17
         26    >   FE_FREE                                                  $14
   34    27        INIT_FCALL                                               'array_values'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                         $18     
         30        ASSIGN                                                   !2, $18
   35    31        INIT_FCALL                                               'var_dump'
         32        SEND_VAR                                                 !2
         33        DO_ICALL                                                 
         34      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.39 ms | 1008 KiB | 16 Q