Im looking for a way to sort this array by the key "Created" so i get the newest record first. Anyone have an idea on how to do this?
My array contains about 2500 records and growing and is formated as follows:
array(2525) {
[0]=> array(1) {
[0]=> array(11) {
["id"]=> int(0)
["Filename"]=> string(20) "011899988199119725-3"
["Uri_MP4"]=> string(35) "/v4/output/011899988199119725-3.mp4"
["Uri_PNG"]=> string(41) "/v4/output/thumb/011899988199119725-3.png"
["Uri_GIF"]=> string(29) "/gif/011899988199119725-3.gif"
["SizeMP4"]=> string(9) "391.44 KB"
["Created"]=> string(16) "2019-08-07 13:24"
["Width"]=> int(400)
["Height"]=> int(222)
["Duration"]=> string(4) "0:11"
}
}
i have tried:
$keys = array_column($array_, 'Created');
array_multisort($keys, SORT_DESC, $array_);
and
$sortedArray = Arr::sortByKeys($array_, 'Created');
and
function date_sort($a, $b) {
return strtotime($a) - strtotime($b);
}
$test = usort($array_, "date_sort");
print_r($test);