3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ ['number' => 2, 'letter' => 'a', 'price' => 9.99], ['number' => 3, 'letter' => 'b', 'price' => 9.99], ['number' => 1, 'letter' => 'c', 'price' => 9.50], ['number' => 1, 'letter' => 'd', 'price' => 10], ['number' => 1, 'letter' => 'e', 'price' => 9.99], ]; $sortingParams[] = array_column($array, 'number'); // 1-dimensional $sortingParams[] = SORT_ASC; // this is omittable as well because it is assumed (just for demo) $sortingParams[] = array_column($array, 'price'); // 1-dimensional $sortingParams[] = SORT_DESC; $sortingParams[] = SORT_NUMERIC; // this is omittable as well because it is assumed (just for demo) $sortingParams[] = &$array; // this is the actual master array which should be modified array_multisort(...$sortingParams); // unpack with splat operator var_export($array);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/dbq2F
function name:  (null)
number of ops:  29
compiled vars:  !0 = $array, !1 = $sortingParams
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
   10     1        INIT_FCALL                                               'array_column'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'number'
          4        DO_ICALL                                         $4      
          5        ASSIGN_DIM                                               !1
          6        OP_DATA                                                  $4
   11     7        ASSIGN_DIM                                               !1
          8        OP_DATA                                                  4
   12     9        INIT_FCALL                                               'array_column'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 'price'
         12        DO_ICALL                                         $7      
         13        ASSIGN_DIM                                               !1
         14        OP_DATA                                                  $7
   13    15        ASSIGN_DIM                                               !1
         16        OP_DATA                                                  3
   14    17        ASSIGN_DIM                                               !1
         18        OP_DATA                                                  1
   15    19        FETCH_DIM_W                                      $10     !1
         20        ASSIGN_REF                                               $10, !0
   17    21        INIT_FCALL                                               'array_multisort'
         22        SEND_UNPACK                                              !1
         23        CHECK_UNDEF_ARGS                                         
         24        DO_ICALL                                                 
   18    25        INIT_FCALL                                               'var_export'
         26        SEND_VAR                                                 !0
         27        DO_ICALL                                                 
         28      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
297.74 ms | 1007 KiB | 16 Q