I have problem ordering an array in the way I want.
This is an example output of my array:
# 159 rows in total
Array
(
[0] => Array
(
[0] => pastebin
[1] =>
[2] => 1305025723
[3] => /fcTGqQGD
)
[1] => Array
(
[0] => pastebin
[1] =>
[2] => 1305025723
[3] => /YQNk8yqa
)
[2] => Array
(
[0] => pastebin
[1] =>
[2] => 1305025723
[3] => /u2BNPrad
)
[3] => Array
(
[0] => pastebin
[1] =>
[2] => 1305025722
[3] => /d/blogdialain.com
)
[4] => Array
(
[0] => pastebin
[1] =>
[2] => 1305025722
[3] => /d/shopcraze.com
)
[5] => Array
(
[0] => pastebin
[1] =>
[2] => 1305025722
[3] => /domains_archive/175
)
[6] => Array
(
[0] => pastebin
[1] =>
[2] => 1305025722
[3] => /d/togou.com
)
[7] => Array
(
[0] => pastebin
[1] =>
[2] => 1305025722
[3] => /W6NafmJa
)
)
Complete array data here: http://pastebin.com/GJNBmqL7
Data comes from various database at once, so I'm limited in the way that I put the data into the array.
The [2] always contains a linux timestamp. Now I want the entire array to be ordered by that timestamp, with the lowest value first.
How can I get that done?
here an array_multisort example:
foreach ($array as $key => $node) {
$timestamps[$key] = $node[2];
}
array_multisort($timestamps, SORT_ASC, $array);