just a little upgrade: > You should be able to achieve this quite simply with a user sort: > > usort($input, 'mysort'); > > function mysort($a, $b) { if ($a['counter'] == $b['counter']) return 0; > return ($a['counter'] > $b['counter']) ? 1 : -1; > } or: function mysort($a,$b) { return ($a['counter'] - $b['counter']); > > -- > Rajesh > > --- In php-objects@xxxxxxxxxxxxxxx, Francisco - São Paulo - Brazil > <avs1001@...> wrote: >> >> I have this array: >> >> Array >> ( >> [0] => Array >> ( >> [account] => 263 >> [counter] => 1 >> ) >> >> [1] => Array >> ( >> [account] => 324 >> [counter] => 5 >> ) >> >> [2] => Array >> ( >> [account] => 972 >> [counter] => 3 >> ) >> >> [3] => Array >> ( >> [account] => 1316 >> [counter] => 3 >> ) >> >> [4] => Array >> ( >> [account] => 1380 >> [counter] => 1 >> ) >> >> [5] => Array >> ( >> [account] => 1880 >> [counter] => 2 >> ) >> ) >> >> I need to sort by the key [counter], how can I do that? > > > > > > > PHP Data object relational mapping generator > http://www.metastorage.net/ > Yahoo! Groups Links > > > > > > > > -- José Miguel Santibáñez jms@xxxxxxxxx ------------------------ Yahoo! Groups Sponsor --------------------~--> Great things are happening at Yahoo! Groups. See the new email design. http://us.click.yahoo.com/TISQkA/hOaOAA/yQLSAA/saFolB/TM --------------------------------------------------------------------~-> PHP Data object relational mapping generator http://www.metastorage.net/ Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-objects/ <*> To unsubscribe from this group, send an email to: php-objects-unsubscribe@xxxxxxxxxxxxxxx <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/