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"); $scores = array( "Mike" => array(04, 03, 00, 07, 04, 07, 00, 01, 00, 07, 04), "Kyle" => array(07, 01, 00, 03, 04, 01, 00, 07, 03, 04, 04), "Johnny" => array(07, 07, 00, 03, 00, 04, 00, 01, 01, 04, 03), "Will" => array(03, 04, 00, 03, 04, 07, 00, 01, 00, 07, 04), "Vasques" => array(03, 01, 00, 03, 04, 07, 00, 01, 00, 07, 07) ); //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 = 7, Position 2 = 37
Branch analysis from position: 7
2 jumps found. (Code = 78) Position 1 = 8, Position 2 = 37
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 23
Branch analysis from position: 35
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
Branch analysis from position: 23
2 jumps found. (Code = 44) Position 1 = 35, Position 2 = 23
Branch analysis from position: 35
Branch analysis from position: 23
Branch analysis from position: 37
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 37
filename:       /in/ZBmFF
function name:  (null)
number of ops:  39
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        ASSIGN                                                   !0, <array>
   27     6      > FE_RESET_R                                       $7      !0, ->37
          7    > > FE_FETCH_R                                       ~8      $7, !1, ->37
          8    >   ASSIGN                                                   !2, ~8
   28     9        ECHO                                                     '%3Ctr%3E'
   30    10        ROPE_INIT                                     3  ~11     '%3Ctd%3E'
         11        ROPE_ADD                                      1  ~11     ~11, !2
         12        ROPE_END                                      2  ~10     ~11, '%3C%2Ftd%3E'
         13        ECHO                                                     ~10
   32    14        INIT_FCALL                                               'array_sum'
         15        FETCH_DIM_R                                      ~13     !0, 'Mike'
         16        SEND_VAL                                                 ~13
         17        DO_ICALL                                         $14     
         18        CONCAT                                           ~15     '%3Ctd+class%3D%27total%27+align%3D%27center%27+valign%3D%27middle%27%3E', $14
         19        CONCAT                                           ~16     ~15, '%3C%2Ftd%3E'
         20        ECHO                                                     ~16
   34    21        ASSIGN                                                   !3, 0
         22      > JMP                                                      ->32
   35    23    >   INIT_FCALL                                               'sprintf'
         24        SEND_VAL                                                 '%2502d'
         25        FETCH_DIM_R                                      ~18     !1, !3
         26        SEND_VAL                                                 ~18
         27        DO_ICALL                                         $19     
         28        CONCAT                                           ~20     '%3Ctd+class%3D%27games+tip%27+align%3D%27center%27+valign%3D%27middle%27%3E', $19
         29        CONCAT                                           ~21     ~20, '%3C%2Ftd%3E'
         30        ECHO                                                     ~21
   34    31        PRE_INC                                                  !3
         32    >   COUNT                                            ~23     !1
         33        IS_SMALLER                                               !3, ~23
         34      > JMPNZ                                                    ~24, ->23
   37    35    >   ECHO                                                     '%3C%2Ftr%3E'
   27    36      > JMP                                                      ->7
         37    >   FE_FREE                                                  $7
   38    38      > RETURN                                                   1

Function cmp:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/ZBmFF
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:
159.13 ms | 1400 KiB | 19 Q