3v4l.org

run code in 500+ PHP versions simultaneously
<?php error_reporting(E_ALL); $arr = [["url_id" => 2191238, "time_spent" => 41], ["url_id" => 2191606, "time_spent" => 215], ["url_id" => 2191606, "time_spent" => 25] ]; $its_by_url = []; foreach($arr as $data) { if ( !isset( $its_by_url[ $data["url_id"] ] ) ) { $its_by_url[ $data["url_id"] ] = 0; } $its_by_url[ $data["url_id"] ] += $data["time_spent"]; } print_r($its_by_url);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 19
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 19
Branch analysis from position: 7
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 14
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 14
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
filename:       /in/WWb6n
function name:  (null)
number of ops:  24
compiled vars:  !0 = $arr, !1 = $its_by_url, !2 = $data
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    2     0  E >   INIT_FCALL                                                   'error_reporting'
          1        SEND_VAL                                                     30719
          2        DO_ICALL                                                     
    4     3        ASSIGN                                                       !0, <array>
    9     4        ASSIGN                                                       !1, <array>
   11     5      > FE_RESET_R                                           $6      !0, ->19
          6    > > FE_FETCH_R                                                   $6, !2, ->19
   12     7    >   FETCH_DIM_R                                          ~7      !2, 'url_id'
          8        ISSET_ISEMPTY_DIM_OBJ                             0  ~8      !1, ~7
          9        BOOL_NOT                                             ~9      ~8
         10      > JMPZ                                                         ~9, ->14
   13    11    >   FETCH_DIM_R                                          ~10     !2, 'url_id'
         12        ASSIGN_DIM                                                   !1, ~10
         13        OP_DATA                                                      0
   15    14    >   FETCH_DIM_R                                          ~12     !2, 'url_id'
         15        FETCH_DIM_R                                          ~14     !2, 'time_spent'
         16        ASSIGN_DIM_OP                    +=               1          !1, ~12
         17        OP_DATA                                                      ~14
   11    18      > JMP                                                          ->6
         19    >   FE_FREE                                                      $6
   18    20        INIT_FCALL                                                   'print_r'
         21        SEND_VAR                                                     !1
         22        DO_ICALL                                                     
         23      > RETURN                                                       1

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
217.66 ms | 2621 KiB | 15 Q