3v4l.org

run code in 300+ PHP versions simultaneously
<?php $order = array('ACO', 'ZCO', 'Other'); function compare($a, $b) { $ai = array_search($a, $order); $bi = array_search($b, $order); return $a<$b ? -1 : $a>$b; } $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/e2JBf
function name:  (null)
number of ops:  11
compiled vars:  !0 = $order, !1 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   11     1        ASSIGN                                                   !1, <array>
   12     2        INIT_FCALL                                               'uksort'
          3        SEND_REF                                                 !1
          4        FETCH_CONSTANT                                   ~4      'compare'
          5        SEND_VAL                                                 ~4
          6        DO_ICALL                                                 
   13     7        INIT_FCALL                                               'print_r'
          8        SEND_VAR                                                 !1
          9        DO_ICALL                                                 
         10      > RETURN                                                   1

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

End of function compare

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
162 ms | 1396 KiB | 19 Q