3v4l.org

run code in 300+ PHP versions simultaneously
<?php $scores = array( "Kyle" => array(07, 01, 00, 03, 04, 01, 00, 07, 03, 04, 04), "Mike" => array(04, 03, 00, 07, 04, 07, 00, 01, 00, 07, 04), "Will" => array(03, 04, 00, 03, 04, 07, 00, 01, 00, 07, 04), "Johnny" => array(07, 07, 00, 03, 00, 04, 00, 01, 01, 04, 03), "Vasques" => array(03, 01, 00, 03, 04, 07, 00, 01, 00, 07, 07) ); function cmp($a, $b) { return array_sum($b) - array_sum($a); } uasort($scores, "cmp"); //start loop for rows foreach($scores as $key=>$value) { echo "<tr>"; //column for the names echo "<td>$key</td>"; //Total Column echo "<td class='total' align='center' valign='middle'>" . array_sum($scores["Mike"]) . "</td>"; //loop for columns where the score should be displayed for($x=0; $x<count($value); $x++) { echo "<td class='games tip' align='center' valign='middle'>".sprintf('%02d', $value[$x])."</td>"; } echo "</tr>"; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 6, Position 2 = 36
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 36
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 22
Branch analysis from position: 34
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 22
2 jumps found. (Code = 44) Position 1 = 34, Position 2 = 22
Branch analysis from position: 34
Branch analysis from position: 22
Branch analysis from position: 36
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 36
filename:       /in/BaUmm
function name:  (null)
number of ops:  38
compiled vars:  !0 = $scores, !1 = $value, !2 = $key, !3 = $x
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   15     1        INIT_FCALL                                               'uasort'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'cmp'
          4        DO_ICALL                                                 
   18     5      > FE_RESET_R                                       $6      !0, ->36
          6    > > FE_FETCH_R                                       ~7      $6, !1, ->36
          7    >   ASSIGN                                                   !2, ~7
   19     8        ECHO                                                     '%3Ctr%3E'
   21     9        ROPE_INIT                                     3  ~10     '%3Ctd%3E'
         10        ROPE_ADD                                      1  ~10     ~10, !2
         11        ROPE_END                                      2  ~9      ~10, '%3C%2Ftd%3E'
         12        ECHO                                                     ~9
   23    13        INIT_FCALL                                               'array_sum'
         14        FETCH_DIM_R                                      ~12     !0, 'Mike'
         15        SEND_VAL                                                 ~12
         16        DO_ICALL                                         $13     
         17        CONCAT                                           ~14     '%3Ctd+class%3D%27total%27+align%3D%27center%27+valign%3D%27middle%27%3E', $13
         18        CONCAT                                           ~15     ~14, '%3C%2Ftd%3E'
         19        ECHO                                                     ~15
   25    20        ASSIGN                                                   !3, 0
         21      > JMP                                                      ->31
   26    22    >   INIT_FCALL                                               'sprintf'
         23        SEND_VAL                                                 '%2502d'
         24        FETCH_DIM_R                                      ~17     !1, !3
         25        SEND_VAL                                                 ~17
         26        DO_ICALL                                         $18     
         27        CONCAT                                           ~19     '%3Ctd+class%3D%27games+tip%27+align%3D%27center%27+valign%3D%27middle%27%3E', $18
         28        CONCAT                                           ~20     ~19, '%3C%2Ftd%3E'
         29        ECHO                                                     ~20
   25    30        PRE_INC                                                  !3
         31    >   COUNT                                            ~22     !1
         32        IS_SMALLER                                               !3, ~22
         33      > JMPNZ                                                    ~23, ->22
   28    34    >   ECHO                                                     '%3C%2Ftr%3E'
   18    35      > JMP                                                      ->6
         36    >   FE_FREE                                                  $6
   29    37      > RETURN                                                   1

Function cmp:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/BaUmm
function name:  cmp
number of ops:  11
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   13     2        INIT_FCALL                                               'array_sum'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $2      
          5        INIT_FCALL                                               'array_sum'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $3      
          8        SUB                                              ~4      $2, $3
          9      > RETURN                                                   ~4
   14    10*     > RETURN                                                   null

End of function cmp

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.79 ms | 1400 KiB | 19 Q