3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ 'a' => 2, 'z' => 2, 'd' => 1 ]; $allowlist = ['a', 'd']; uksort( $array, static function($a, $b) use ($array, $allowlist) { if($array[$a] === $array[$b]) { return in_array($a, $allowlist) ? -1 : 1; } return $array[$b] <=> $array[$a]; } ); var_dump($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/toZIt
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                                  '%00%7Bclosure%7D%2Fin%2FtoZIt%3A12%240'
          5        BIND_LEXICAL                                             ~4, !0
          6        BIND_LEXICAL                                             ~4, !1
   17     7        SEND_VAL                                                 ~4
          8        DO_ICALL                                                 
   20     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
         12      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FtoZIt%3A12%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 17
Branch analysis from position: 8
2 jumps found. (Code = 43) Position 1 = 13, Position 2 = 15
Branch analysis from position: 13
1 jumps found. (Code = 42) Position 1 = 16
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/toZIt
function name:  {closure}
number of ops:  22
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, !0
          5        FETCH_DIM_R                                      ~5      !2, !1
          6        IS_IDENTICAL                                             ~4, ~5
          7      > JMPZ                                                     ~6, ->17
   14     8    >   INIT_FCALL                                               'in_array'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !3
         11        DO_ICALL                                         $7      
         12      > JMPZ                                                     $7, ->15
         13    >   QM_ASSIGN                                        ~8      -1
         14      > JMP                                                      ->16
         15    >   QM_ASSIGN                                        ~8      1
         16    > > RETURN                                                   ~8
   16    17    >   FETCH_DIM_R                                      ~9      !2, !1
         18        FETCH_DIM_R                                      ~10     !2, !0
         19        SPACESHIP                                        ~11     ~9, ~10
         20      > RETURN                                                   ~11
   17    21*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FtoZIt%3A12%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
147.62 ms | 1400 KiB | 19 Q