You could use usort()
with some custom logic to accomplish this:
$array = array(
array('date' => '2012-05-15', 'name' => 'jon'),
array('date' => '2012-05-10', 'name' => 'jon'),
array('date' => '2012-05-09', 'name' => 'jon'),
array('date' => '2012-05-16', 'name' => 'jon')
);
function mySorter( $a, $b ) {
if ( $a['date'] < $b['date'] ) return -1;
if ( $a['date'] > $b['date'] ) return 1;
return 0;
}
usort( $array, mySorter );
When all is said and done, $array
now looks like this:
Array
(
[0] => Array
(
[date] => 2012-05-09
[name] => jon
)
[1] => Array
(
[date] => 2012-05-10
[name] => jon
)
[2] => Array
(
[date] => 2012-05-15
[name] => jon
)
[3] => Array
(
[date] => 2012-05-16
[name] => jon
)
)