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"); */ function sort_function(array $a, array $b) { $arr1_val = array_sum($a); $arr2_val = array_sum($b); return $arr2_val - $arr1_val; } uasort($scores,"sort_function"); print_r($scores);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/h4oXP
function name:  (null)
number of ops:  9
compiled vars:  !0 = $scores
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   24     1        INIT_FCALL                                               'uasort'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'sort_function'
          4        DO_ICALL                                                 
   27     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

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

End of function sort_function

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
151.44 ms | 1395 KiB | 19 Q