3v4l.org

run code in 300+ PHP versions simultaneously
<?php $numericPriorities = array_flip([5, 4, 65]); $numericOutlier = count($numericPriorities); $wordPriorities = array_flip(['first', 'second', 'third']); $wordOutlier = count($wordPriorities); $arr = ['third' => 321, 4 => 1, 'zero' => 'last of words', 7 => 'last of nums', 65 => 6, 'first' => 63, 5 => 88, 'second' => 0]; uksort( $arr, function($a, $b) use ($numericPriorities, $numericOutlier, $wordPriorities, $wordOutlier) { return !is_int($a) <=> !is_int($b) ?: (($numericPriorities[$a] ?? $numericOutlier) <=> ($numericPriorities[$b] ?? $numericOutlier)) ?: (($wordPriorities[$a] ?? $wordOutlier) <=> ($wordPriorities[$b] ?? $wordOutlier)); } ); var_export($arr);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/6DEtQ
function name:  (null)
number of ops:  26
compiled vars:  !0 = $numericPriorities, !1 = $numericOutlier, !2 = $wordPriorities, !3 = $wordOutlier, !4 = $arr
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'array_flip'
          1        SEND_VAL                                                 <array>
          2        DO_ICALL                                         $5      
          3        ASSIGN                                                   !0, $5
    4     4        COUNT                                            ~7      !0
          5        ASSIGN                                                   !1, ~7
    5     6        INIT_FCALL                                               'array_flip'
          7        SEND_VAL                                                 <array>
          8        DO_ICALL                                         $9      
          9        ASSIGN                                                   !2, $9
    6    10        COUNT                                            ~11     !2
         11        ASSIGN                                                   !3, ~11
    8    12        ASSIGN                                                   !4, <array>
   10    13        INIT_FCALL                                               'uksort'
   11    14        SEND_REF                                                 !4
   12    15        DECLARE_LAMBDA_FUNCTION                          ~14     [0]
         16        BIND_LEXICAL                                             ~14, !0
         17        BIND_LEXICAL                                             ~14, !1
         18        BIND_LEXICAL                                             ~14, !2
         19        BIND_LEXICAL                                             ~14, !3
   16    20        SEND_VAL                                                 ~14
   10    21        DO_ICALL                                                 
   19    22        INIT_FCALL                                               'var_export'
         23        SEND_VAR                                                 !4
         24        DO_ICALL                                                 
         25      > 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/6DEtQ
function name:  {closure}
number of ops:  31
compiled vars:  !0 = $a, !1 = $b, !2 = $numericPriorities, !3 = $numericOutlier, !4 = $wordPriorities, !5 = $wordOutlier
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
          3        BIND_STATIC                                              !3
          4        BIND_STATIC                                              !4
          5        BIND_STATIC                                              !5
   13     6        TYPE_CHECK                                   16  ~6      !0
          7        BOOL_NOT                                         ~7      ~6
          8        TYPE_CHECK                                   16  ~8      !1
          9        BOOL_NOT                                         ~9      ~8
         10        SPACESHIP                                        ~10     ~7, ~9
         11        JMP_SET                                          ~11     ~10, ->20
   14    12        FETCH_DIM_IS                                     ~12     !2, !0
         13        COALESCE                                         ~13     ~12
         14        QM_ASSIGN                                        ~13     !3
         15        FETCH_DIM_IS                                     ~14     !2, !1
         16        COALESCE                                         ~15     ~14
         17        QM_ASSIGN                                        ~15     !3
         18        SPACESHIP                                        ~16     ~13, ~15
         19        QM_ASSIGN                                        ~11     ~16
         20        JMP_SET                                          ~17     ~11, ->29
   15    21        FETCH_DIM_IS                                     ~18     !4, !0
         22        COALESCE                                         ~19     ~18
         23        QM_ASSIGN                                        ~19     !5
         24        FETCH_DIM_IS                                     ~20     !4, !1
         25        COALESCE                                         ~21     ~20
         26        QM_ASSIGN                                        ~21     !5
         27        SPACESHIP                                        ~22     ~19, ~21
         28        QM_ASSIGN                                        ~17     ~22
         29      > RETURN                                                   ~17
   16    30*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
140.58 ms | 1007 KiB | 16 Q