3v4l.org

run code in 300+ PHP versions simultaneously
<?php $data = array( array("type"=>"fruit", "price"=>3.50), array("type"=>"milk", "price"=>2.90), array("type"=>"pork", "price"=>5.43), ); $inventory = $data; $time = microtime(true); array_multisort(array_column($inventory, 'price'), SORT_DESC, $inventory); echo microtime(true)-$time; $new = []; $time = microtime(true); foreach($data as $row){ $new[$row['type']] = $row; } ksort($new); echo microtime(true)-$time; print_r($inventory); print_r($new);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 31
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 31
Branch analysis from position: 27
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 31
filename:       /in/ABCgW
function name:  (null)
number of ops:  47
compiled vars:  !0 = $data, !1 = $inventory, !2 = $time, !3 = $new, !4 = $row
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, !0
   11     2        INIT_FCALL                                               'microtime'
          3        SEND_VAL                                                 <true>
          4        DO_ICALL                                         $7      
          5        ASSIGN                                                   !2, $7
   12     6        INIT_FCALL                                               'array_multisort'
          7        INIT_FCALL                                               'array_column'
          8        SEND_VAR                                                 !1
          9        SEND_VAL                                                 'price'
         10        DO_ICALL                                         $9      
         11        SEND_VAL                                                 $9
         12        SEND_VAL                                                 3
         13        SEND_REF                                                 !1
         14        DO_ICALL                                                 
   13    15        INIT_FCALL                                               'microtime'
         16        SEND_VAL                                                 <true>
         17        DO_ICALL                                         $11     
         18        SUB                                              ~12     $11, !2
         19        ECHO                                                     ~12
   15    20        ASSIGN                                                   !3, <array>
   16    21        INIT_FCALL                                               'microtime'
         22        SEND_VAL                                                 <true>
         23        DO_ICALL                                         $14     
         24        ASSIGN                                                   !2, $14
   17    25      > FE_RESET_R                                       $16     !0, ->31
         26    > > FE_FETCH_R                                               $16, !4, ->31
   18    27    >   FETCH_DIM_R                                      ~17     !4, 'type'
         28        ASSIGN_DIM                                               !3, ~17
         29        OP_DATA                                                  !4
   17    30      > JMP                                                      ->26
         31    >   FE_FREE                                                  $16
   20    32        INIT_FCALL                                               'ksort'
         33        SEND_REF                                                 !3
         34        DO_ICALL                                                 
   21    35        INIT_FCALL                                               'microtime'
         36        SEND_VAL                                                 <true>
         37        DO_ICALL                                         $20     
         38        SUB                                              ~21     $20, !2
         39        ECHO                                                     ~21
   23    40        INIT_FCALL                                               'print_r'
         41        SEND_VAR                                                 !1
         42        DO_ICALL                                                 
   24    43        INIT_FCALL                                               'print_r'
         44        SEND_VAR                                                 !3
         45        DO_ICALL                                                 
         46      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.9 ms | 1400 KiB | 23 Q