Sort Array based on Date and/or Time
http://stackoverflow.com/questions/8121241/sort-array-based-on-the-datetime-in-php
<?php
EXAMPLE 1 for an array with key and values with dateTime key
$ord = array();
foreach ($array as $key => $value){
$ord[] = strtotime($value['dateTime']);
}
array_multisort($ord, SORT_ASC, $array);
print_r($array);
ExAMPLE 2:
$str = "01|15|59, 1|47|16, 01|17|20, 1|32|34, 01|17|22, 01|14|20";
$arr = explode(',', str_replace('|',':',$str) ) ; //change to 01:15:59
//print_r($arr) ;
$ord = array() ;
echo ( count($arr) % 2 == 0 ) ? "EVEN" : "ODD" . "\n" ;
for ( $i=0; $i< count($arr) ; $i++ ){
$ord[] = strtotime( $arr[$i] );
}
array_multisort($ord, SORT_ASC, $arr);
print_r($arr);