3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = [ ['price'=>100, 'rank'=>3], ['price'=>55000, 'rank'=>4], ['price'=>500, 'rank'=>5], ['price'=>130, 'rank'=>3], ['price'=>25000, 'rank'=>4], ['price'=>50000, 'rank'=>4], ['price'=>120, 'rank'=>3], ['price'=>1000, 'rank'=>5], ]; $price = array_column($arr, 'price'); $rank = array_column($arr, 'rank'); // Sort the data with price descending, rank descending // Add $data as the last parameter, to sort by the common key array_multisort($rank, SORT_DESC, $price, SORT_DESC, $arr); echo '<pre>'; print_r($arr); die;
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/noMnE
function name:  (null)
number of ops:  24
compiled vars:  !0 = $arr, !1 = $price, !2 = $rank
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
   14     1        INIT_FCALL                                               'array_column'
          2        SEND_VAR                                                 !0
          3        SEND_VAL                                                 'price'
          4        DO_ICALL                                         $4      
          5        ASSIGN                                                   !1, $4
   15     6        INIT_FCALL                                               'array_column'
          7        SEND_VAR                                                 !0
          8        SEND_VAL                                                 'rank'
          9        DO_ICALL                                         $6      
         10        ASSIGN                                                   !2, $6
   19    11        INIT_FCALL                                               'array_multisort'
         12        SEND_REF                                                 !2
         13        SEND_VAL                                                 3
         14        SEND_REF                                                 !1
         15        SEND_VAL                                                 3
         16        SEND_REF                                                 !0
         17        DO_ICALL                                                 
   21    18        ECHO                                                     '%3Cpre%3E'
   22    19        INIT_FCALL                                               'print_r'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                                 
   23    22      > EXIT                                                     
   24    23*     > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.31 ms | 1012 KiB | 16 Q