3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ '2' => [ 'title' => 'Flower', 'order' => 3 ], '3' => [ 'title' => 'Rock', 'order' => 1 ], '4' => [ 'title' => 'Grass', 'order' => 2 ] ]; $keys = array_keys($array); array_multisort( array_column($array, 'order'), SORT_DESC, SORT_NUMERIC, $array, $keys ); $array = array_combine($keys, $array); print_r($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/K5GhU
function name:  (null)
number of ops:  25
compiled vars:  !0 = $array, !1 = $keys
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   17     1        INIT_FCALL                                               'array_keys'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $3      
          4        ASSIGN                                                   !1, $3
   18     5        INIT_FCALL                                               'array_multisort'
   19     6        INIT_FCALL                                               'array_column'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 'order'
          9        DO_ICALL                                         $5      
         10        SEND_VAL                                                 $5
         11        SEND_VAL                                                 3
         12        SEND_VAL                                                 1
         13        SEND_REF                                                 !0
         14        SEND_REF                                                 !1
   18    15        DO_ICALL                                                 
   21    16        INIT_FCALL                                               'array_combine'
         17        SEND_VAR                                                 !1
         18        SEND_VAR                                                 !0
         19        DO_ICALL                                         $7      
         20        ASSIGN                                                   !0, $7
   23    21        INIT_FCALL                                               'print_r'
         22        SEND_VAR                                                 !0
         23        DO_ICALL                                                 
         24      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
177.9 ms | 1455 KiB | 18 Q