Using ksort in PHP for SQL datetime format in reverse order
题
Is it possible to use ksort
to sort by maximum (ie. most recent) date with a SQL date time format? I have an array that is currently key-value where the key is the SQL date time format and the value is a string. When I do a ksort
on it, it returns it by the least recent (I'm guessing the 'smallest') first and I want the reverse of that. Is there a flag that I don't know of that could set this or another function that could do it better?
解决方案
If you just want the reverse order of ksort
, use krsort
.
其他提示
If the data is from SQL, why not have the DBMS sort the date data into the correct order?
不隶属于 StackOverflow