Sorting an array based on its value

Posted by MaxerDude on Stack Overflow See other posts from Stack Overflow or by MaxerDude
Published on 2011-01-17T18:31:52Z Indexed on 2011/01/17 18:53 UTC
Read the original article Hit count: 140

I have an Array, Sample:

$array {
 [0] {
   [something]=1;
   [something2]=2;
     } 
 [1] {
   [something]=2;
   [something2]=4;
     }
 [2] {
   [something]=5;
   [something2]=2;
     }
}

I want to order the array based on the key something;

So it will look like:

$array {
 [0] {
   [something]=5;
   [something2]=2;
     } 
 [1] {
   [something]=2;
   [something2]=4;
     }
 [2] {
   [something]=1;
   [something2]=2;
     }
}

© Stack Overflow or respective owner

Related posts about php

Related posts about arrays