Array Sorting PHP by timestamp
use usort that accepts custom function to sort arrays:
usort
your function may look something like:
function cmp($a, $b)
{
if ($a[2] == $b[2]) {
return 0;
}
return ($a[2] < $b[2]) ? -1 : 1;
}
here an array_multisort example:
foreach ($array as $key => $node) {
$timestamps[$key] = $node[2];
}
array_multisort($timestamps, SORT_ASC, $array);