3v4l.org

run code in 300+ PHP versions simultaneously
<?php $user = []; $arr = [[ 'chatduration' => 124.502,'username' => 'bhavin'],[ 'chatduration' => 124.502,'username' => 'bhavin']]; foreach($arr as $record){ if (array_key_exists($record['username'],$record)) { $user[$record['username']] = $user[$record['username']] + $record['chatduration']; } else { $user[$record['username']] = $record['chatduration']; } } print_r($user);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 20
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 20
Branch analysis from position: 4
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 15
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
filename:       /in/PYuX5
function name:  (null)
number of ops:  25
compiled vars:  !0 = $user, !1 = $arr, !2 = $record
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    3     1        ASSIGN                                                   !1, <array>
    5     2      > FE_RESET_R                                       $5      !1, ->20
          3    > > FE_FETCH_R                                               $5, !2, ->20
    7     4    >   FETCH_DIM_R                                      ~6      !2, 'username'
          5        ARRAY_KEY_EXISTS                                         ~6, !2
          6      > JMPZ                                                     ~7, ->15
    9     7    >   FETCH_DIM_R                                      ~8      !2, 'username'
          8        FETCH_DIM_R                                      ~10     !2, 'username'
          9        FETCH_DIM_R                                      ~11     !0, ~10
         10        FETCH_DIM_R                                      ~12     !2, 'chatduration'
         11        ADD                                              ~13     ~11, ~12
         12        ASSIGN_DIM                                               !0, ~8
         13        OP_DATA                                                  ~13
         14      > JMP                                                      ->19
   13    15    >   FETCH_DIM_R                                      ~14     !2, 'username'
         16        FETCH_DIM_R                                      ~16     !2, 'chatduration'
         17        ASSIGN_DIM                                               !0, ~14
         18        OP_DATA                                                  ~16
    5    19    > > JMP                                                      ->3
         20    >   FE_FREE                                                  $5
   18    21        INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
167.74 ms | 1396 KiB | 15 Q