3v4l.org

run code in 300+ PHP versions simultaneously
<?php $aShips = ['0_204' => 1, '0_209' => 1.5,'0_205' => 2, '0_206' => 3, '0_207' => 4]; $order = ["0_206", "0_205", "0_204", "0_207"]; $lookup = array_flip($order); $default = count($order); uksort($aShips, fn($a, $b) => ($lookup[$a] ?? $default) <=> ($lookup[$b] ?? $default)); var_export($aShips);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/80ODY
function name:  (null)
number of ops:  19
compiled vars:  !0 = $aShips, !1 = $order, !2 = $lookup, !3 = $default
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN                                                   !1, <array>
    6     2        INIT_FCALL                                               'array_flip'
          3        SEND_VAR                                                 !1
          4        DO_ICALL                                         $6      
          5        ASSIGN                                                   !2, $6
    7     6        COUNT                                            ~8      !1
          7        ASSIGN                                                   !3, ~8
    9     8        INIT_FCALL                                               'uksort'
          9        SEND_REF                                                 !0
         10        DECLARE_LAMBDA_FUNCTION                          ~10     [0]
         11        BIND_LEXICAL                                             ~10, !2
         12        BIND_LEXICAL                                             ~10, !3
         13        SEND_VAL                                                 ~10
         14        DO_ICALL                                                 
   11    15        INIT_FCALL                                               'var_export'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
         18      > 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/80ODY
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $a, !1 = $b, !2 = $lookup, !3 = $default
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
          4        FETCH_DIM_IS                                     ~4      !2, !0
          5        COALESCE                                         ~5      ~4
          6        QM_ASSIGN                                        ~5      !3
          7        FETCH_DIM_IS                                     ~6      !2, !1
          8        COALESCE                                         ~7      ~6
          9        QM_ASSIGN                                        ~7      !3
         10        SPACESHIP                                        ~8      ~5, ~7
         11      > RETURN                                                   ~8
         12*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
138.88 ms | 1003 KiB | 16 Q