3v4l.org

run code in 300+ PHP versions simultaneously
<?php function compare($a, $b) { $order = array('ACO', 'ZCO', 'Other'); $ai = array_search($a, $order); $bi = array_search($b, $order); return $ai<$bi ? -1 : $ai>$bi; } $a = array('ZCO'=>1, 'Other'=>1, 'ACO'=>1); uksort($a, "compare"); print_r($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e6jfI
function name:  (null)
number of ops:  9
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, <array>
   12     1        INIT_FCALL                                               'uksort'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'compare'
          4        DO_ICALL                                                 
   13     5        INIT_FCALL                                               'print_r'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Function compare:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 15, Position 2 = 17
Branch analysis from position: 15
1 jumps found. (Code = 42) Position 1 = 19
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e6jfI
function name:  compare
number of ops:  21
compiled vars:  !0 = $a, !1 = $b, !2 = $order, !3 = $ai, !4 = $bi
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        ASSIGN                                                   !2, <array>
    7     3        INIT_FCALL                                               'array_search'
          4        SEND_VAR                                                 !0
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $6      
          7        ASSIGN                                                   !3, $6
    8     8        INIT_FCALL                                               'array_search'
          9        SEND_VAR                                                 !1
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $8      
         12        ASSIGN                                                   !4, $8
    9    13        IS_SMALLER                                               !3, !4
         14      > JMPZ                                                     ~10, ->17
         15    >   QM_ASSIGN                                        ~11     -1
         16      > JMP                                                      ->19
         17    >   IS_SMALLER                                       ~12     !4, !3
         18        QM_ASSIGN                                        ~11     ~12
         19    > > RETURN                                                   ~11
   10    20*     > RETURN                                                   null

End of function compare

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162.18 ms | 1396 KiB | 19 Q