3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $alternatives = array( 'foo' => 0, 'foo1' => 0, 'foo3' => 0, ); asort($alternatives, SORT_STRING); print_r($alternatives); $keys = array_keys($alternatives); print_r($keys); sort($keys); print_r($keys); sort($keys, SORT_STRING); print_r($keys); sort($keys, SORT_NATURAL); print_r($keys);
based on mjj8q
Finding entry points
Branch analysis from position: 0
Jump found. Position 1 = -2
filename:       /in/rjbjk
function name:  (null)
number of ops:  36
compiled vars:  !0 = $alternatives, !1 = $keys
line     #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   4     0  E >   ASSIGN                                                   !0, <array>
   8     1        INIT_FCALL                                               'asort'
         2        SEND_REF                                                 !0
         3        SEND_VAL                                                 2
         4        DO_ICALL                                                 
  10     5        INIT_FCALL                                               'print_r'
         6        SEND_VAR                                                 !0
         7        DO_ICALL                                                 
  12     8        INIT_FCALL                                               'array_keys'
         9        SEND_VAR                                                 !0
        10        DO_ICALL                                         $5      
        11        ASSIGN                                                   !1, $5
  13    12        INIT_FCALL                                               'print_r'
        13        SEND_VAR                                                 !1
        14        DO_ICALL                                                 
  15    15        INIT_FCALL                                               'sort'
        16        SEND_REF                                                 !1
        17        DO_ICALL                                                 
  16    18        INIT_FCALL                                               'print_r'
        19        SEND_VAR                                                 !1
        20        DO_ICALL                                                 
  18    21        INIT_FCALL                                               'sort'
        22        SEND_REF                                                 !1
        23        SEND_VAL                                                 2
        24        DO_ICALL                                                 
  19    25        INIT_FCALL                                               'print_r'
        26        SEND_VAR                                                 !1
        27        DO_ICALL                                                 
  21    28        INIT_FCALL                                               'sort'
        29        SEND_REF                                                 !1
        30        SEND_VAL                                                 6
        31        DO_ICALL                                                 
  22    32        INIT_FCALL                                               'print_r'
        33        SEND_VAR                                                 !1
        34        DO_ICALL                                                 
        35      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 7.1.0