3v4l.org

run code in 500+ PHP versions simultaneously
<?php $sortMe = [100, 1, 10, 1000]; function cmp($a, $b) { static $example = [1, 1000, 100, 10]; return array_search($a, $example) - array_search($b, $example); } uasort($sortMe, 'cmp'); var_export($sortMe);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gbbua
function name:  (null)
number of ops:  9
compiled vars:  !0 = $sortMe
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                       !0, <array>
    9     1        INIT_FCALL                                                   'uasort'
          2        SEND_REF                                                     !0
          3        SEND_VAL                                                     'cmp'
          4        DO_ICALL                                                     
   10     5        INIT_FCALL                                                   'var_export'
          6        SEND_VAR                                                     !0
          7        DO_ICALL                                                     
          8      > RETURN                                                       1

Function cmp:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/gbbua
function name:  cmp
number of ops:  14
compiled vars:  !0 = $a, !1 = $b, !2 = $example
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    5     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
    6     2        BIND_STATIC                                                  !2
    7     3        INIT_FCALL                                                   'array_search'
          4        SEND_VAR                                                     !0
          5        SEND_VAR                                                     !2
          6        DO_ICALL                                             $3      
          7        INIT_FCALL                                                   'array_search'
          8        SEND_VAR                                                     !1
          9        SEND_VAR                                                     !2
         10        DO_ICALL                                             $4      
         11        SUB                                                  ~5      $3, $4
         12      > RETURN                                                       ~5
    8    13*     > RETURN                                                       null

End of function cmp

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
159.11 ms | 1764 KiB | 16 Q