2014-06-17, 16:08:24
Ohh... I forgot to explain that we have date as a string e.g. "17 Jun 2014"
The task is, to turn a string giving a date and into a timestamp.
You can do it with strtotime() for example. So your sort_array() function would then look as follows:
The task is, to turn a string giving a date and into a timestamp.
You can do it with strtotime() for example. So your sort_array() function would then look as follows:
PHP Code:
function sort_array($a, $b)
{
$a = strtotime($a['date']);
$b = strtotime($b['date']);
if ($a == $b)
{
return 0;
}
else
{
if($a < $b)
{
return 1;
}
else
{
return -1;
}
}
}