least number in array

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sleepwalker0
Forum Newbie
Posts: 17
Joined: Sun Feb 19, 2006 4:13 pm

least number in array

Post by sleepwalker0 »

Hi this seems like a really nice community so I want to say hello :D

As you probably noticed I'm new to php and just learning.

Heres my qestion, how can I represent numbers in array like the least number or the greatest or the second least and so on. I need to sort some numbers from least to greatest but I can't use "sort()" Any suggestions.

Sleepwalker
User avatar
jwalsh
Forum Contributor
Posts: 202
Joined: Sat Jan 03, 2004 4:55 pm
Location: Cleveland, OH

Post by jwalsh »

Why can't you use sort() ?
sleepwalker0
Forum Newbie
Posts: 17
Joined: Sun Feb 19, 2006 4:13 pm

Post by sleepwalker0 »

:? theres a good reason, its one of a tasks I have to complete long story..I have a good reason, anybody has any thoughts on programming side?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

programming your own sort()? search around for bubble-sort algorithms. (hint: Wikipedia)
duk
Forum Contributor
Posts: 199
Joined: Wed May 19, 2004 8:45 am
Location: London

Post by duk »

theres a idea...

create a temporary table, then insert every value, into... then select all numbers and orber by ASC or DESC, and use-it for what you need, then just delete the table...

is what come to my mind first :D
Post Reply