On Thu, 23 Aug 2001 12:58, Chris Aitken wrote:
> Hi all,
>
> Just a quick one,
>
> I am pulling a whole Class C list of IP addresses, and im trying to
> sort them in order, but im getting it displayed
>
> 127.0.0.1
> 127.0.0.10
> 127.0.0.100
> 127.0.0.101
> 127.0.0.102
>
> etc. Is there any other way to sort this thinking they are numbers,
> rather than text ?
>
>
> Thanks
>
>
> Chris
Chris
Poke them in an array, and use asort() or sort()with the sortflag
parameter set for numeric. I think that should work.
The optional second parameter sort_flags may be used to modify the
sorting behavior using theese values:
Sorting type flags:
• SORT_REGULAR - compare items normally
• SORT_NUMERIC - compare items numerically
• SORT_STRING - compare items as strings
--
David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc
CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA
"I'm about to hit the golf ball," Tom forewarned.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]