3v4l.org

run code in 300+ PHP versions simultaneously
<?php $inputArray = array('Tuesday' => null, 'Friday' => null, 'Monday' => null, 'Thursday' => null, 'Wednesday' => null); $desiredIndexOrder = array('Monday' => 5, 'Tuesday' => 4, 'Wednesday' => 3, 'Thursday' => 2, 'Friday' => 1); uksort($inputArray, function($a, $b) use ($desiredIndexOrder) { return $desiredIndexOrder[$a] > $desiredIndexOrder[$b] ? -1 : 1; }); echo print_r($inputArray);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PveoK
function name:  (null)
number of ops:  13
compiled vars:  !0 = $inputArray, !1 = $desiredIndexOrder
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'uksort'
          3        SEND_REF                                                 !0
          4        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FPveoK%3A6%240'
          5        BIND_LEXICAL                                             ~4, !1
    8     6        SEND_VAL                                                 ~4
          7        DO_ICALL                                                 
   10     8        INIT_FCALL                                               'print_r'
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $6      
         11        ECHO                                                     $6
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FPveoK%3A6%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PveoK
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $a, !1 = $b, !2 = $desiredIndexOrder
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
    7     3        FETCH_DIM_R                                      ~3      !2, !0
          4        FETCH_DIM_R                                      ~4      !2, !1
          5        IS_SMALLER                                               ~4, ~3
          6      > JMPZ                                                     ~5, ->9
          7    >   QM_ASSIGN                                        ~6      -1
          8      > JMP                                                      ->10
          9    >   QM_ASSIGN                                        ~6      1
         10    > > RETURN                                                   ~6
    8    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FPveoK%3A6%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.63 ms | 1396 KiB | 17 Q