3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr =array( array(1,22,3,6,3), array(4,16,2,10,1), array(11,2,3,5,9), array(3,8,12,4,8) ); function vhall_sort($arr){ $a=$new=array(); foreach($arr as $k=>$v){ $num=array_sum($v); $a[$k]=$num/count($v); } arsort($a); foreach ($a as $k=>$v){ $new[$k] = $arr[$k]; } return $new; } echo '<pre>'; print_r($arr); print_r(vhall_sort($arr));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/58bJ7
function name:  (null)
number of ops:  12
compiled vars:  !0 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   21     1        ECHO                                                     '%3Cpre%3E'
   22     2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   23     5        INIT_FCALL                                               'print_r'
          6        INIT_FCALL                                               'vhall_sort'
          7        SEND_VAR                                                 !0
          8        DO_FCALL                                      0  $3      
          9        SEND_VAR                                                 $3
         10        DO_ICALL                                                 
         11      > RETURN                                                   1

Function vhall_sort:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 4, Position 2 = 15
Branch analysis from position: 4
2 jumps found. (Code = 78) Position 1 = 5, Position 2 = 15
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 4
Branch analysis from position: 4
Branch analysis from position: 15
2 jumps found. (Code = 77) Position 1 = 20, Position 2 = 26
Branch analysis from position: 20
2 jumps found. (Code = 78) Position 1 = 21, Position 2 = 26
Branch analysis from position: 21
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
Branch analysis from position: 15
filename:       /in/58bJ7
function name:  vhall_sort
number of ops:  29
compiled vars:  !0 = $arr, !1 = $a, !2 = $new, !3 = $v, !4 = $k, !5 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
   10     1        ASSIGN                                           ~6      !2, <array>
          2        ASSIGN                                                   !1, ~6
   11     3      > FE_RESET_R                                       $8      !0, ->15
          4    > > FE_FETCH_R                                       ~9      $8, !3, ->15
          5    >   ASSIGN                                                   !4, ~9
   12     6        INIT_FCALL                                               'array_sum'
          7        SEND_VAR                                                 !3
          8        DO_ICALL                                         $11     
          9        ASSIGN                                                   !5, $11
   13    10        COUNT                                            ~14     !3
         11        DIV                                              ~15     !5, ~14
         12        ASSIGN_DIM                                               !1, !4
         13        OP_DATA                                                  ~15
   11    14      > JMP                                                      ->4
         15    >   FE_FREE                                                  $8
   15    16        INIT_FCALL                                               'arsort'
         17        SEND_REF                                                 !1
         18        DO_ICALL                                                 
   16    19      > FE_RESET_R                                       $17     !1, ->26
         20    > > FE_FETCH_R                                       ~18     $17, !3, ->26
         21    >   ASSIGN                                                   !4, ~18
   17    22        FETCH_DIM_R                                      ~21     !0, !4
         23        ASSIGN_DIM                                               !2, !4
         24        OP_DATA                                                  ~21
   16    25      > JMP                                                      ->20
         26    >   FE_FREE                                                  $17
   19    27      > RETURN                                                   !2
   20    28*     > RETURN                                                   null

End of function vhall_sort

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.46 ms | 1403 KiB | 20 Q