3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['group' => 'A', 'name' => 'Ann', 'age' => 19], ['group' => 'B', 'name' => 'Bea', 'age' => 26], ['group' => 'A', 'name' => 'Cam', 'age' => 32], ['group' => 'B', 'name' => 'Des', 'age' => 24] ]; $result = []; foreach ($array as ['group' => $group, 'group' => $result[$group]['group'], 'name' => $name, 'age' => $result[$group][$name]]); var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/Rn9eB
function name:  (null)
number of ops:  23
compiled vars:  !0 = $array, !1 = $result, !2 = $group, !3 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   10     2      > FE_RESET_R                                       $6      !0, ->18
          3    > > FE_FETCH_R                                               $6, $7, ->18
          4    >   FETCH_LIST_R                                     $8      $7, 'group'
          5        ASSIGN                                                   !2, $8
          6        FETCH_LIST_R                                     $10     $7, 'group'
          7        FETCH_DIM_W                                      $11     !1, !2
          8        ASSIGN_DIM                                               $11, 'group'
          9        OP_DATA                                                  $10
         10        FETCH_LIST_R                                     $13     $7, 'name'
         11        ASSIGN                                                   !3, $13
         12        FETCH_LIST_R                                     $15     $7, 'age'
         13        FETCH_DIM_W                                      $16     !1, !2
         14        ASSIGN_DIM                                               $16, !3
         15        OP_DATA                                                  $15
         16        FREE                                                     $7
         17      > JMP                                                      ->3
         18    >   FE_FREE                                                  $6
   11    19        INIT_FCALL                                               'var_export'
         20        SEND_VAR                                                 !1
         21        DO_ICALL                                                 
         22      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
169.55 ms | 1395 KiB | 15 Q