Re: Sorting IP Address Data

From: Date: Thu, 23 Aug 2001 03:58:27 +0000
Subject: Re: Sorting IP Address Data
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-64037@lists.php.net to get a copy of this message
That looks clumsy, but it will work : you could make a multidimensional hash (treat it like table) like ips["first"][x] ips["second"][x] etc it is like table "ips": first | second | third | etc ----------------------------- 127 | 0 | 0 | 127. | 0 | 1 | etc using split() function and sort it by one of the dimensions with array_multisort and then make every line of this table a string with something like implode(). :)) Gregory. "Chris Aitken" <chris@ideal.net.au> wrote in message news:5.1.0.14.2.20010823132543.028cfb58@mail.ideal.net.au... > 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 Aitken - Administration/Database Designer - IDEAL Internet > email: chris@ideal.net.au phone: +61 2 4628 8888 fax: +61 2 4628 8890 > __-----------------------------------------__ > *** Big Brother *** > It just shows that the dull will rule the world. And we will be watching it. >

« previous php.general (#64037) next »