sikken Posted February 23, 2011 Share Posted February 23, 2011 i need some help sorting my arrays. i have a class that selects data from database, and holds it inside a class to be used multiple times. rather then executing multiple queries. i know how to sort an array. but i am sorting arrays inside an array $data = arrray( array( 'id'=>1, '_name'=>'Server A', '_date_added'=>1298207645.5424, ); array( 'id'=>2, '_name'=>'Server B', '_date_added'=>1298247384.4839, ); array( 'id'=>3, '_name'=>'Server C', '_date_added'=>1298218493.0493, ); ); i want to sort my array descending by key _date_added hope you understand... Quote Link to comment https://forums.phpfreaks.com/topic/228649-sort-associative-array/ Share on other sites More sharing options...
PFMaBiSmAd Posted February 23, 2011 Share Posted February 23, 2011 Why not sort it the way you want it in the query? Quote Link to comment https://forums.phpfreaks.com/topic/228649-sort-associative-array/#findComment-1178915 Share on other sites More sharing options...
sikken Posted February 23, 2011 Author Share Posted February 23, 2011 when it comes out of the database, it is already sorted. i need to change the sort. Quote Link to comment https://forums.phpfreaks.com/topic/228649-sort-associative-array/#findComment-1178928 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.