3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = ["Post1" => "Platinum", "Post2" => "Bronze", "Post3" => "Gold", "Post4" => "Uncomplete", "Post5" => "Gold"]; $order = array_flip(["Platinum", "Gold", "Silver", "Bronze", "Complete", "None", "Uncomplete"]); // makes: array ('Platinum' => 0, 'Gold' => 1, 'Silver' => 2, 'Bronze' => 3, 'Complete' => 4, 'None' => 5, 'Uncomplete' => 6) uasort($array, function ($a, $b) use ($order) { return $order[$a] <=> $order[$b]; }); var_export($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Cr86T
function name:  (null)
number of ops:  15
compiled vars:  !0 = $array, !1 = $order
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    4     1        INIT_FCALL                                               'array_flip'
          2        SEND_VAL                                                 <array>
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
    6     5        INIT_FCALL                                               'uasort'
          6        SEND_REF                                                 !0
          7        DECLARE_LAMBDA_FUNCTION                          ~5      [0]
          8        BIND_LEXICAL                                             ~5, !1
    8     9        SEND_VAL                                                 ~5
    6    10        DO_ICALL                                                 
   10    11        INIT_FCALL                                               'var_export'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                                 
         14      > 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/Cr86T
function name:  {closure}
number of ops:  8
compiled vars:  !0 = $a, !1 = $b, !2 = $order
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        SPACESHIP                                        ~5      ~3, ~4
          6      > RETURN                                                   ~5
    8     7*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.93 ms | 1012 KiB | 16 Q