Объявление
foreach ($data['file'] as $key => $value) {
$data['size'][] = human_filesize(filesize($dir.SEP.$value));
$data['date'][] = date("Y-m-d H:m:s", filemtime($dir.SEP.$value));
$data['src'][] = 'files/'.SEP.$value;
}
Сортировка
function cmp($a, $b)
{
foreach ($b as $key => $value) {
echo $key."=".$value."<br/>";
}
$t1 = strtotime($a['date']);
$t2 = strtotime($b['date']);
return ($t2<$t1) ? -1 : 1;
}
Что выдает foreach:
0=uploadphp.zip
1=translate.php
2=sqlite3-0.6.tgz
3=script-1.2.min.js
0=2014-10-03 11:10:29
1=2014-10-03 10:10:46
2=2014-10-03 09:10:05
3=2014-10-03 10:10:30
0=4.00K
1=1.18K
2=750.29K
3=137.97K
0=2014-10-03 11:10:29
1=2014-10-03 10:10:46
2=2014-10-03 09:10:05
3=2014-10-03 10:10:30
null
UPD:
array_multisotr:
Warning: array_multisort(): Array sizes are inconsistent
Array ( [0] => 2014-10-03 11:10:29 [1] => 2014-10-03 10:10:46 [2] => 2014-10-03 09:10:05 [3] => 2014-10-03 10:10:30 [4] => 2014-10-03 14:10:00 )
Array ( [file] => Array ( [0] => uploadphp.zip [1] => translate.php [2] => sqlite3-0.6.tgz [3] => script-1.2.min.js [4] => boxes.pptx ) [size] => Array ( [0] => 4.00K [1] => 1.18K [2] => 750.29K [3] => 137.97K [4] => 38.14K ) [date] => Array ( [0] => 2014-10-03 11:10:29 [1] => 2014-10-03 10:10:46 [2] => 2014-10-03 09:10:05 [3] => 2014-10-03 10:10:30 [4] => 2014-10-03 14:10:00 ) [src] => Array ( [0] => files/uploadphp.zip [1] => files/translate.php [2] => files/sqlite3-0.6.tgz [3] => files/script-1.2.min.js [4] => files/boxes.pptx ) )