3v4l.org

run code in 300+ PHP versions simultaneously
<?php $Arr1=[ ["id" => "4123", "test_number" => "1", "sat_total" => "1050"], ["id" => "4123", "test_number" => "2", "sat_total" => "1130"], ["id" => "4123", "test_number" => "3", "sat_total" => "1120"], ["id" => "5555", "test_number" => "1", "sat_total" => "1130"], ["id" => "5555", "test_number" => "2", "sat_total" => "1160"] ]; foreach ($Arr1 as $set) { if (!isset($result[$set['id']])) { $result[$set['id']] = ['id' => $set['id'], 'Score1' => $set['sat_total']]; } else { $result[$set['id']]['Score' . sizeof($result[$set['id']])] = $set['sat_total']; } } var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 25
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 25
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 25
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 25
filename:       /in/WHUW7
function name:  (null)
number of ops:  33
compiled vars:  !0 = $Arr1, !1 = $set, !2 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   10     1      > FE_RESET_R                                       $4      !0, ->25
          2    > > FE_FETCH_R                                               $4, !1, ->25
   11     3    >   FETCH_DIM_R                                      ~5      !1, 'id'
          4        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !2, ~5
          5        BOOL_NOT                                         ~7      ~6
          6      > JMPZ                                                     ~7, ->15
   12     7    >   FETCH_DIM_R                                      ~8      !1, 'id'
          8        FETCH_DIM_R                                      ~10     !1, 'id'
          9        INIT_ARRAY                                       ~11     ~10, 'id'
         10        FETCH_DIM_R                                      ~12     !1, 'sat_total'
         11        ADD_ARRAY_ELEMENT                                ~11     ~12, 'Score1'
         12        ASSIGN_DIM                                               !2, ~8
         13        OP_DATA                                                  ~11
   11    14      > JMP                                                      ->24
   14    15    >   FETCH_DIM_R                                      ~13     !1, 'id'
         16        FETCH_DIM_R                                      ~15     !1, 'id'
         17        FETCH_DIM_R                                      ~16     !2, ~15
         18        COUNT                                            ~17     ~16
         19        CONCAT                                           ~18     'Score', ~17
         20        FETCH_DIM_R                                      ~20     !1, 'sat_total'
         21        FETCH_DIM_W                                      $14     !2, ~13
         22        ASSIGN_DIM                                               $14, ~18
         23        OP_DATA                                                  ~20
   10    24    > > JMP                                                      ->2
         25    >   FE_FREE                                                  $4
   18    26        INIT_FCALL                                               'var_export'
         27        INIT_FCALL                                               'array_values'
         28        SEND_VAR                                                 !2
         29        DO_ICALL                                         $21     
         30        SEND_VAR                                                 $21
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.8 ms | 1002 KiB | 15 Q