php - how to sort an array based on previous numerical keys? -


this question has answer here:

i sort array reindex keys. tried using custom loop not work. there php function this? have array this:

array (     [3] => array         (             [id] => 44             [name] => 1495714823.jpg         )     [1] => array         (             [id] => 48             [name] => 1495795384.jpg         )     [2] => array         (             [id] => 11             [name] => 1495602099.jpg         ) ) 

i need sort array this:

array (     [1] => array         (             [id] => 48             [name] => 1495795384.jpg         )     [2] => array         (             [id] => 11             [name] => 1495602099.jpg         )     [3] => array         (             [id] => 44             [name] => 1495714823.jpg         ) ) 

i tried of sort functions didn't work.

i think need ksort

ksort($array);  

this should give output looking for.
see here output: https://3v4l.org/hgv4f


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -