[PHP] Ip address as 32bit int?

2002-11-22 Thread Noodle Snacks
Is it easy enough to change a formated IP addy (eg 192.168.0.1) to the 32bit
unsigned int that computers use?

the reason I ask is because it is alot more efficient space wise in a db to
be storing a 32bit number rather that a char or varchar field.

Or am I going to run into trouble because all ints are signed in PHP?


--
JJ Harrison
[EMAIL PROTECTED]






-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] Ip address as 32bit int?

2002-11-22 Thread Joakim Andersson
In MySQL (and others?) you can use these two functions:
INET_NTOA(expr)
INET_ATON(expr)

Regards
Joakim


- Original Message -
From: Noodle Snacks [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Friday, November 22, 2002 10:13 AM
Subject: [PHP] Ip address as 32bit int?


Is it easy enough to change a formated IP addy (eg 192.168.0.1) to the 32bit
unsigned int that computers use?

the reason I ask is because it is alot more efficient space wise in a db to
be storing a 32bit number rather that a char or varchar field.

Or am I going to run into trouble because all ints are signed in PHP?


--
JJ Harrison
[EMAIL PROTECTED]






--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] Ip address as 32bit int?

2002-11-22 Thread Mark Charette
 From: Noodle Snacks [mailto:[EMAIL PROTECTED]]

 the reason I ask is because it is alot more efficient space wise
 in a db to
 be storing a 32bit number rather that a char or varchar field.

While it is more efficient space-wise (4 bytes vs. 12 bytes), the price of
the additional disk storage needed for storing them is trivial (unless you
have a billions). Make sure you consider the addtional costs of maintenance,
too, when you store data in a non-human format.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php