Question: 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;
     }
}

```

Answer: 
```
function compare($x, $y) {
    return $x['something'] - $y['something'];
}

usort($input_array, 'compare');

```

you need to use a [`usort()`](http://www.php.net/manual/en/function.usort.php) similar to the above.
Would the following suffice?

```
foreach($array as $key => $value){
    ksort( $array[$key] );
}

```