3v4l.org

run code in 300+ PHP versions simultaneously
<?php $sizes = array("L", "XXXL", "M", "S", "FOO"); function compare($a, $b) { $sizeincrement = array("XS", "S", "M", "L", "XL", "XXL", "XXXL"); if(in_array($b,$sizeincrement)) return array_search($a, $sizeincrement) > array_search($b, $sizeincrement); else return false; } usort($sizes, "compare"); print_r($sizes);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nnlp7
function name:  (null)
number of ops:  9
compiled vars:  !0 = $sizes
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'usort'
          2        SEND_REF                                                 !0
          3        SEND_VAL                                                 'compare'
          4        DO_ICALL                                                 
   12     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 = 8, Position 2 = 19
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Nnlp7
function name:  compare
number of ops:  21
compiled vars:  !0 = $a, !1 = $b, !2 = $sizeincrement
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        ASSIGN                                                   !2, <array>
    6     3        INIT_FCALL                                               'in_array'
          4        SEND_VAR                                                 !1
          5        SEND_VAR                                                 !2
          6        DO_ICALL                                         $4      
          7      > JMPZ                                                     $4, ->19
          8    >   INIT_FCALL                                               'array_search'
          9        SEND_VAR                                                 !0
         10        SEND_VAR                                                 !2
         11        DO_ICALL                                         $5      
         12        INIT_FCALL                                               'array_search'
         13        SEND_VAR                                                 !1
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                         $6      
         16        IS_SMALLER                                       ~7      $6, $5
         17      > RETURN                                                   ~7
         18*       JMP                                                      ->20
    7    19    > > RETURN                                                   <false>
    8    20*     > RETURN                                                   null

End of function compare

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.16 ms | 1388 KiB | 21 Q