3v4l.org

run code in 500+ PHP versions simultaneously
<?php $array = [ 'a' => 2, 'z' => 2, 'd' => 1 ]; $allowlist = ['a', 'd']; uksort( $array, fn($a, $b) => $array[$b] <=> $array[$a] ?: in_array($b, $allowlist) <=> in_array($a, $allowlist) ); var_export($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dQ9eP
function name:  (null)
number of ops:  13
compiled vars:  !0 = $array, !1 = $allowlist
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    8     1        ASSIGN                                                       !1, <array>
   10     2        INIT_FCALL                                                   'uksort'
   11     3        SEND_REF                                                     !0
   12     4        DECLARE_LAMBDA_FUNCTION                              ~4      [0]
          5        BIND_LEXICAL                                                 ~4, !0
          6        BIND_LEXICAL                                                 ~4, !1
   15     7        SEND_VAL                                                     ~4
   10     8        DO_ICALL                                                     
   17     9        INIT_FCALL                                                   'var_export'
         10        SEND_VAR                                                     !0
         11        DO_ICALL                                                     
         12      > 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/dQ9eP
function name:  {closure:/in/dQ9eP:12}
number of ops:  14
compiled vars:  !0 = $a, !1 = $b, !2 = $array, !3 = $allowlist
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
   13     4        FETCH_DIM_R                                          ~4      !2, !1
          5        FETCH_DIM_R                                          ~5      !2, !0
          6        SPACESHIP                                            ~6      ~4, ~5
          7        JMP_SET                                              ~7      ~6, ->12
   14     8        FRAMELESS_ICALL_2                in_array            ~8      !1, !3
          9        FRAMELESS_ICALL_2                in_array            ~9      !0, !3
         10        SPACESHIP                                            ~10     ~8, ~9
         11        QM_ASSIGN                                            ~7      ~10
         12      > RETURN                                                       ~7
   15    13*     > RETURN                                                       null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
169.06 ms | 2005 KiB | 15 Q