3v4l.org

run code in 300+ PHP versions simultaneously
<?php $people = array( array("name"=>"Bob","age"=>8,"colour"=>"red"), array("name"=>"Greg","age"=>12,"colour"=>"blue"), array("name"=>"Andy","age"=>5,"colour"=>"purple") ); $arrSortArray = array(); foreach($people as $person) { foreach($person as $key=>$value){ if(!isset($arrSortArray[$key])){ $arrSortArray[$key] = array(); } $arrSortArray[$key][] = $value; } } $orderby = "name"; //change this to whatever key you want from the array var_dump($people); array_multisort($arrSortArray[$orderby],SORT_DESC,$people); var_dump($people);
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 3, Position 2 = 18
Branch analysis from position: 3
2 jumps found. (Code = 78) Position 1 = 4, Position 2 = 18
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 16
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 16
Branch analysis from position: 6
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 12
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 12
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 3
Branch analysis from position: 3
Branch analysis from position: 16
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
filename:       /in/VeTKv
function name:  (null)
number of ops:  33
compiled vars:  !0 = $people, !1 = $arrSortArray, !2 = $person, !3 = $value, !4 = $key, !5 = $orderby
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    9     1        ASSIGN                                                   !1, <array>
   11     2      > FE_RESET_R                                       $8      !0, ->18
          3    > > FE_FETCH_R                                               $8, !2, ->18
   12     4    > > FE_RESET_R                                       $9      !2, ->16
          5    > > FE_FETCH_R                                       ~10     $9, !3, ->16
          6    >   ASSIGN                                                   !4, ~10
   13     7        ISSET_ISEMPTY_DIM_OBJ                         0  ~12     !1, !4
          8        BOOL_NOT                                         ~13     ~12
          9      > JMPZ                                                     ~13, ->12
   14    10    >   ASSIGN_DIM                                               !1, !4
         11        OP_DATA                                                  <array>
   16    12    >   FETCH_DIM_W                                      $15     !1, !4
         13        ASSIGN_DIM                                               $15
         14        OP_DATA                                                  !3
   12    15      > JMP                                                      ->5
         16    >   FE_FREE                                                  $9
   11    17      > JMP                                                      ->3
         18    >   FE_FREE                                                  $8
   20    19        ASSIGN                                                   !5, 'name'
   22    20        INIT_FCALL                                               'var_dump'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                                 
   24    23        INIT_FCALL                                               'array_multisort'
         24        FETCH_DIM_W                                      $19     !1, !5
         25        SEND_REF                                                 $19
         26        SEND_VAL                                                 3
         27        SEND_REF                                                 !0
         28        DO_ICALL                                                 
   26    29        INIT_FCALL                                               'var_dump'
         30        SEND_VAR                                                 !0
         31        DO_ICALL                                                 
         32      > RETURN                                                   1

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.52 ms | 1396 KiB | 17 Q