Pregunta

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?

¿Fue útil?

Solución

If you just want the reverse order of ksort, use krsort.

Otros consejos

If the data is from SQL, why not have the DBMS sort the date data into the correct order?

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top