3v4l.org

run code in 300+ PHP versions simultaneously
<?php $results = [ 1 => 220,0 => 209,4 => 127, 14 => 89, 3 => 84, 7 => 78, 2 => 71, 13 => 61, 16 => 56, 8 => 48, 12 => 45, 10 => 42, 11 => 42, 6 => 39, 5 => 35, 9 => 32, 15 => 22, 17 => 22, 18 => 22, 19 => 1 ]; $anotherArray1 = [11 => 101, 10 => 119]; $anotherArray2 = [17 => 150, 18 => 160, 15 => 179]; $sekArr = array_replace($results,$anotherArray1,$anotherArray2); $newArr = []; foreach($results as $key => $value){ $newArr[$key] = ["v" => $value, 's' => $sekArr[$key]]; } uasort($newArr, function($a,$b){ return $b['v'] <=> $a['v'] ?: $a['s'] <=> $b['s']; }); $results = []; foreach($newArr as $key => $arr){ $results[$key] = $arr['v']; } var_dump($results);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 19
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 19
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 19
2 jumps found. (Code = 77) Position 1 = 27, Position 2 = 33
Branch analysis from position: 27
2 jumps found. (Code = 78) Position 1 = 28, Position 2 = 33
Branch analysis from position: 28
1 jumps found. (Code = 42) Position 1 = 27
Branch analysis from position: 27
Branch analysis from position: 33
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 33
Branch analysis from position: 19
filename:       /in/Si6ST
function name:  (null)
number of ops:  38
compiled vars:  !0 = $results, !1 = $anotherArray1, !2 = $anotherArray2, !3 = $sekArr, !4 = $newArr, !5 = $value, !6 = $key, !7 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    8     1        ASSIGN                                                   !1, <array>
    9     2        ASSIGN                                                   !2, <array>
   11     3        INIT_FCALL                                               'array_replace'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !1
          6        SEND_VAR                                                 !2
          7        DO_ICALL                                         $11     
          8        ASSIGN                                                   !3, $11
   13     9        ASSIGN                                                   !4, <array>
   14    10      > FE_RESET_R                                       $14     !0, ->19
         11    > > FE_FETCH_R                                       ~15     $14, !5, ->19
         12    >   ASSIGN                                                   !6, ~15
   15    13        INIT_ARRAY                                       ~18     !5, 'v'
         14        FETCH_DIM_R                                      ~19     !3, !6
         15        ADD_ARRAY_ELEMENT                                ~18     ~19, 's'
         16        ASSIGN_DIM                                               !4, !6
         17        OP_DATA                                                  ~18
   14    18      > JMP                                                      ->11
         19    >   FE_FREE                                                  $14
   18    20        INIT_FCALL                                               'uasort'
         21        SEND_REF                                                 !4
         22        DECLARE_LAMBDA_FUNCTION                          ~20     [0]
   20    23        SEND_VAL                                                 ~20
   18    24        DO_ICALL                                                 
   22    25        ASSIGN                                                   !0, <array>
   23    26      > FE_RESET_R                                       $23     !4, ->33
         27    > > FE_FETCH_R                                       ~24     $23, !7, ->33
         28    >   ASSIGN                                                   !6, ~24
   24    29        FETCH_DIM_R                                      ~27     !7, 'v'
         30        ASSIGN_DIM                                               !0, !6
         31        OP_DATA                                                  ~27
   23    32      > JMP                                                      ->27
         33    >   FE_FREE                                                  $23
   27    34        INIT_FCALL                                               'var_dump'
         35        SEND_VAR                                                 !0
         36        DO_ICALL                                                 
         37      > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Si6ST
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   19     2        FETCH_DIM_R                                      ~2      !1, 'v'
          3        FETCH_DIM_R                                      ~3      !0, 'v'
          4        SPACESHIP                                        ~4      ~2, ~3
          5        JMP_SET                                          ~5      ~4, ->10
          6        FETCH_DIM_R                                      ~6      !0, 's'
          7        FETCH_DIM_R                                      ~7      !1, 's'
          8        SPACESHIP                                        ~8      ~6, ~7
          9        QM_ASSIGN                                        ~5      ~8
         10      > RETURN                                                   ~5
   20    11*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
124.43 ms | 1017 KiB | 16 Q