3v4l.org

run code in 300+ PHP versions simultaneously
<?php $scores = array( array(1, "allan", 90), array(2, "allan", 85), array(3, "mark", 100), array(4, "jason", 88), array(5, "allan", 92), array(6, "mark", 77), array(7, "mark", 88), array(8, "jason", 90) ); foreach($scores as $e) { if (!isset($res[$e[1]])) $res[$e[1]] = 0; $res[$e[1]] += $e[2]; } print_r(array_keys($res, max($res)));
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 2, Position 2 = 15
Branch analysis from position: 2
2 jumps found. (Code = 78) Position 1 = 3, Position 2 = 15
Branch analysis from position: 3
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 10
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 2
Branch analysis from position: 2
Branch analysis from position: 10
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
filename:       /in/VErjs
function name:  (null)
number of ops:  27
compiled vars:  !0 = $scores, !1 = $e, !2 = $res
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1      > FE_RESET_R                                       $4      !0, ->15
          2    > > FE_FETCH_R                                               $4, !1, ->15
   15     3    >   FETCH_DIM_R                                      ~5      !1, 1
          4        ISSET_ISEMPTY_DIM_OBJ                         0  ~6      !2, ~5
          5        BOOL_NOT                                         ~7      ~6
          6      > JMPZ                                                     ~7, ->10
          7    >   FETCH_DIM_R                                      ~8      !1, 1
          8        ASSIGN_DIM                                               !2, ~8
          9        OP_DATA                                                  0
   16    10    >   FETCH_DIM_R                                      ~10     !1, 1
         11        FETCH_DIM_R                                      ~12     !1, 2
         12        ASSIGN_DIM_OP                +=               1          !2, ~10
         13        OP_DATA                                                  ~12
   14    14      > JMP                                                      ->2
         15    >   FE_FREE                                                  $4
   18    16        INIT_FCALL                                               'print_r'
         17        INIT_FCALL                                               'array_keys'
         18        SEND_VAR                                                 !2
         19        INIT_FCALL                                               'max'
         20        SEND_VAR                                                 !2
         21        DO_ICALL                                         $13     
         22        SEND_VAR                                                 $13
         23        DO_ICALL                                         $14     
         24        SEND_VAR                                                 $14
         25        DO_ICALL                                                 
         26      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.61 ms | 1000 KiB | 16 Q