3v4l.org

run code in 300+ PHP versions simultaneously
<?php $records = [ "Coding", "Web development - Coding", "Meeting", "Coding", "Coding", "Content", "Coding", "Coding" ]; $quantities = [ 3, 8, 1, 4.85, 1, 0.5, 6.01, 7 ]; $result = []; foreach ($records as $index => $label){ $result[$label] = ($result[$label] ?? 0) + $quantities[$index]; } var_export(array_keys($result)); var_export(array_values($result));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 14
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 14
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/MjcUu
function name:  (null)
number of ops:  28
compiled vars:  !0 = $records, !1 = $quantities, !2 = $result, !3 = $label, !4 = $index
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   13     1        ASSIGN                                                   !1, <array>
   24     2        ASSIGN                                                   !2, <array>
   25     3      > FE_RESET_R                                       $8      !0, ->14
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->14
          5    >   ASSIGN                                                   !4, ~9
   26     6        FETCH_DIM_IS                                     ~12     !2, !3
          7        COALESCE                                         ~13     ~12
          8        QM_ASSIGN                                        ~13     0
          9        FETCH_DIM_R                                      ~14     !1, !4
         10        ADD                                              ~15     ~13, ~14
         11        ASSIGN_DIM                                               !2, !3
         12        OP_DATA                                                  ~15
   25    13      > JMP                                                      ->4
         14    >   FE_FREE                                                  $8
   28    15        INIT_FCALL                                               'var_export'
         16        INIT_FCALL                                               'array_keys'
         17        SEND_VAR                                                 !2
         18        DO_ICALL                                         $16     
         19        SEND_VAR                                                 $16
         20        DO_ICALL                                                 
   29    21        INIT_FCALL                                               'var_export'
         22        INIT_FCALL                                               'array_values'
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                         $18     
         25        SEND_VAR                                                 $18
         26        DO_ICALL                                                 
         27      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
186.32 ms | 1003 KiB | 16 Q