GetDotted Domains

Viewing Thread:
"PHP Sorting a array"

The "Freeola Customer Forum" forum, which includes Retro Game Reviews, has been archived and is now read-only. You cannot post here or create a new thread or review on this forum.

Sat 06/07/02 at 16:34
Regular
Posts: 787
Hi i've been playing around with all the different sort array functions but cant get it to work the way i want.

This is how inside my array looks:

blah[0] = 60#cough
blah[1] = 43#blah
blah[2] = 100#woof
blah[3] = 3#moo

..etc

How could i get it to sort the by the numbers before the #?
Sun 07/07/02 at 05:15
Posts: 0
ah that wont work i forgot that some values may be the same i just used them random numbers as an example it could be..

blah[0] = 3#cough
blah[1] = 43#blah
blah[2] = 3#woof
blah[3] = 3#moo

...or anything really there any other ways around this?
Sat 06/07/02 at 21:07
Posts: 0
Ahhh didnt think of that cheers.
Sat 06/07/02 at 17:38
Posts: 0
T0MMY wrote:
> Hi i've been playing around with all the different sort array
> functions but cant get it to work the way i want.
>
> This is how inside my array looks:
>
> blah[0] = 60#cough
> blah[1] = 43#blah
> blah[2] = 100#woof
> blah[3] = 3#moo
>
> ..etc
>
> How could i get it to sort the by the numbers before the #?

not very easily, coz it would think that blah[0] should come after blah[3] coz it would see that 6 > 1.

how about using a different array structure?

try this instead:

blah[60] = cough
blah[43] = blah
blah[100] = woof
blah[3] = moo

PHP will simply fill in the missing $blah entries as NULL
Sat 06/07/02 at 16:34
Posts: 0
Hi i've been playing around with all the different sort array functions but cant get it to work the way i want.

This is how inside my array looks:

blah[0] = 60#cough
blah[1] = 43#blah
blah[2] = 100#woof
blah[3] = 3#moo

..etc

How could i get it to sort the by the numbers before the #?

Freeola & GetDotted are rated 5 Stars

Check out some of our customer reviews below:

Unrivalled services
Freeola has to be one of, if not the best, ISP around as the services they offer seem unrivalled.
Very pleased
Very pleased with the help given by your staff. They explained technical details in an easy way and were patient when providing information to a non expert like me.

View More Reviews

Need some help? Give us a call on 01376 55 60 60

Go to Support Centre

It appears you are using an old browser, as such, some parts of the Freeola and Getdotted site will not work as intended. Using the latest version of your browser, or another browser such as Google Chrome, Mozilla Firefox, or Opera will provide a better, safer browsing experience for you.