3v4l.org

run code in 300+ PHP versions simultaneously
<?php $alternatives = array( 'foo' => 0, 'foo1' => 0, 'foo3' => 0, ); echo 'before sorting:'.PHP_EOL; print_r($alternatives); asort($alternatives, SORT_STRING); echo 'after sorting:'.PHP_EOL; 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);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WeFRT
function name:  (null)
number of ops:  41
compiled vars:  !0 = $alternatives, !1 = $keys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ECHO                                                     'before+sorting%3A%0A'
   10     2        INIT_FCALL                                               'print_r'
          3        SEND_VAR                                                 !0
          4        DO_ICALL                                                 
   12     5        INIT_FCALL                                               'asort'
          6        SEND_REF                                                 !0
          7        SEND_VAL                                                 2
          8        DO_ICALL                                                 
   14     9        ECHO                                                     'after+sorting%3A%0A'
   15    10        INIT_FCALL                                               'print_r'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
   17    13        INIT_FCALL                                               'array_keys'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                         $6      
         16        ASSIGN                                                   !1, $6
   18    17        INIT_FCALL                                               'print_r'
         18        SEND_VAR                                                 !1
         19        DO_ICALL                                                 
   20    20        INIT_FCALL                                               'sort'
         21        SEND_REF                                                 !1
         22        DO_ICALL                                                 
   21    23        INIT_FCALL                                               'print_r'
         24        SEND_VAR                                                 !1
         25        DO_ICALL                                                 
   23    26        INIT_FCALL                                               'sort'
         27        SEND_REF                                                 !1
         28        SEND_VAL                                                 2
         29        DO_ICALL                                                 
   24    30        INIT_FCALL                                               'print_r'
         31        SEND_VAR                                                 !1
         32        DO_ICALL                                                 
   26    33        INIT_FCALL                                               'sort'
         34        SEND_REF                                                 !1
         35        SEND_VAL                                                 6
         36        DO_ICALL                                                 
   27    37        INIT_FCALL                                               'print_r'
         38        SEND_VAR                                                 !1
         39        DO_ICALL                                                 
         40      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.2 ms | 1396 KiB | 21 Q