3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['produkt' => 'blyszczaca', 'model' => 'Normal', 'price' => 27.00, 'qty' => 2], ['blyszczaca', 'Normal', 27.00, 2], ['blyszczaca', 'Normal', 27.00, 2], ['czapkoszal', 'Normal', 41.00, 2], ['czapkoszal', 'Luxury', 45.00, 2], ['czapkoszal', 'Normal', 41.00, 2], ['czapkoszal', 'Normal', 41.00, 1], ['czapkoszal', 'Normal', 41.00, 1], ['etola', 'Wolf', 47.00, 1], ['etola', 'Normal', 39.00, 1], ['etola', 'Normal', 39.00, 1], ]; $result = []; foreach ($array as $row) { $row = array_values($row); $group = "$row[0] $row[1]"; $result[$group] = ($result[$group] ?? 0) + $row[3]; } var_export($result);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 22
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 22
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 22
filename:       /in/eG6G8
function name:  (null)
number of ops:  27
compiled vars:  !0 = $array, !1 = $result, !2 = $row, !3 = $group
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   17     1        ASSIGN                                                   !1, <array>
   18     2      > FE_RESET_R                                       $6      !0, ->22
          3    > > FE_FETCH_R                                               $6, !2, ->22
   19     4    >   INIT_FCALL                                               'array_values'
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $7      
          7        ASSIGN                                                   !2, $7
   20     8        FETCH_DIM_R                                      ~9      !2, 0
          9        ROPE_INIT                                     3  ~12     ~9
         10        ROPE_ADD                                      1  ~12     ~12, '+'
         11        FETCH_DIM_R                                      ~10     !2, 1
         12        ROPE_END                                      2  ~11     ~12, ~10
         13        ASSIGN                                                   !3, ~11
   21    14        FETCH_DIM_IS                                     ~16     !1, !3
         15        COALESCE                                         ~17     ~16
         16        QM_ASSIGN                                        ~17     0
         17        FETCH_DIM_R                                      ~18     !2, 3
         18        ADD                                              ~19     ~17, ~18
         19        ASSIGN_DIM                                               !1, !3
         20        OP_DATA                                                  ~19
   18    21      > JMP                                                      ->3
         22    >   FE_FREE                                                  $6
   23    23        INIT_FCALL                                               'var_export'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
142.57 ms | 1006 KiB | 15 Q