3v4l.org

run code in 300+ PHP versions simultaneously
<?php $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) ); function cmp($a, $b) { return array_sum($b) - array_sum($a); } usort($scores, "cmp"); 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($value) . "</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 = 35
Branch analysis from position: 6
2 jumps found. (Code = 78) Position 1 = 7, Position 2 = 35
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 21
Branch analysis from position: 33
1 jumps found. (Code = 42) Position 1 = 6
Branch analysis from position: 6
Branch analysis from position: 21
2 jumps found. (Code = 44) Position 1 = 33, Position 2 = 21
Branch analysis from position: 33
Branch analysis from position: 21
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 35
filename:       /in/q4nRL
function name:  (null)
number of ops:  37
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>
   14     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'cmp'
          4        DO_ICALL                                                 
   16     5      > FE_RESET_R                                       $6      !0, ->35
          6    > > FE_FETCH_R                                       ~7      $6, !1, ->35
          7    >   ASSIGN                                                   !2, ~7
   17     8        ECHO                                                     '%3Ctr%3E'
   19     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
   21    13        INIT_FCALL                                               'array_sum'
         14        SEND_VAR                                                 !1
         15        DO_ICALL                                         $12     
         16        CONCAT                                           ~13     '%3Ctd+class%3D%27total%27+align%3D%27center%27+valign%3D%27middle%27%3E', $12
         17        CONCAT                                           ~14     ~13, '%3C%2Ftd%3E'
         18        ECHO                                                     ~14
   23    19        ASSIGN                                                   !3, 0
         20      > JMP                                                      ->30
   24    21    >   INIT_FCALL                                               'sprintf'
         22        SEND_VAL                                                 '%2502d'
         23        FETCH_DIM_R                                      ~16     !1, !3
         24        SEND_VAL                                                 ~16
         25        DO_ICALL                                         $17     
         26        CONCAT                                           ~18     '%3Ctd+class%3D%27games+tip%27+align%3D%27center%27+valign%3D%27middle%27%3E', $17
         27        CONCAT                                           ~19     ~18, '%3C%2Ftd%3E'
         28        ECHO                                                     ~19
   23    29        PRE_INC                                                  !3
         30    >   COUNT                                            ~21     !1
         31        IS_SMALLER                                               !3, ~21
         32      > JMPNZ                                                    ~22, ->21
   26    33    >   ECHO                                                     '%3C%2Ftr%3E'
   16    34      > JMP                                                      ->6
         35    >   FE_FREE                                                  $6
   27    36      > RETURN                                                   1

Function cmp:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/q4nRL
function name:  cmp
number of ops:  11
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   12     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
   13    10*     > RETURN                                                   null

End of function cmp

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.6 ms | 1400 KiB | 19 Q