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 (!empty($arr) && 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 = 24
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 24
Branch analysis from position: 4
2 jumps found. (Code = 46) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 23
Branch analysis from position: 23
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 19
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 10
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
filename:       /in/eFuO7
function name:  (null)
number of ops:  29
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, ->24
          3    > > FE_FETCH_R                                               $5, !2, ->24
    7     4    >   ISSET_ISEMPTY_CV                                 ~6      !1
          5        BOOL_NOT                                         ~7      ~6
          6      > JMPZ_EX                                          ~7      ~7, ->10
          7    >   FETCH_DIM_R                                      ~8      !2, 'username'
          8        ARRAY_KEY_EXISTS                                 ~9      ~8, !2
          9        BOOL                                             ~7      ~9
         10    > > JMPZ                                                     ~7, ->19
    9    11    >   FETCH_DIM_R                                      ~10     !2, 'username'
         12        FETCH_DIM_R                                      ~12     !2, 'username'
         13        FETCH_DIM_R                                      ~13     !0, ~12
         14        FETCH_DIM_R                                      ~14     !2, 'chatduration'
         15        ADD                                              ~15     ~13, ~14
         16        ASSIGN_DIM                                               !0, ~10
         17        OP_DATA                                                  ~15
         18      > JMP                                                      ->23
   13    19    >   FETCH_DIM_R                                      ~16     !2, 'username'
         20        FETCH_DIM_R                                      ~18     !2, 'chatduration'
         21        ASSIGN_DIM                                               !0, ~16
         22        OP_DATA                                                  ~18
    5    23    > > JMP                                                      ->3
         24    >   FE_FREE                                                  $5
   18    25        INIT_FCALL                                               'print_r'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.88 ms | 1396 KiB | 15 Q