Re: Re: Sorting an array
| From: | Alex | Date: | Tue, 01 Mar 2011 23:33:58 +0000 |
| Subject: | Re: Re: Sorting an array | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-311611@lists.php.net to get a copy of this message | ||
That or do it in mysql before you get the data back, its also pretty good at sorting, you know ;)
--
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
FeIn <acid24@gmail.com> wrote:
Also check http://www.php.net/manual/en/function.natsort.php
On Tue, Mar 1, 2011 at 1:39 PM, David Robley <robleyd@aapt.net.au> wrote: > Ron Piggott
wrote: > > > > > I need help to know how to sort the words / phrases in my array.
> > > > Variable name: $words_used > > print_r( $words_used ); Current output:
Array ( [187] => Sin [249] => > > Punished [98] => Sanctuary [596] => Sing [362]
=> Anointing Oil ) Desired > > result: Alphabetical sort: Array ( [362] => Anointing Oil
[249] => > > Punished [98] => Sanctuary [187] => Sin [596] => Sing ) > >
> > The #?s are the auto_increment value of the word in the mySQL database. > > The
number is not representative of alphabetical order, but the order it > > was added to the
database. > > > > Thank you for your assistance. > > > > Ron > > Like
the man said - asort. May I recommend you to http://php.net where you
> will find the answer to most of your queries, simply by looking under a > generic area, such
as array (http://php.net/array) for
this particular > problem. Surely you have been around here long enough to be able to find >
things in the documentation, or at least try there first, by now? > > > > > Cheers
> -- > David Robley > > Do fish get thirsty? > Today is Setting Orange, the 60th day
of Chaos in the YOLD 3177. > > > -- > PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
> >