![]() |
convert IP to 10 digit decimal number
Hi guys I need help in converting IP in php.
for example, if we have this IP: 123.456.789.012 I would like to make it as 012.789.456.123 and then convert it to a 10 digit decimal number. This is for a hack I am working on and will be greatful if anyone can help. Thanks Aurous |
Why 10 digits, why not 12?
|
Quote:
|
<a href="http://us4.php.net/manual/en/function.ip2long.php" target="_blank">http://us4.php.net/manual/en/function.ip2long.php</a>
|
Quote:
|
How about:
PHP Code:
|
That's what I was going to suggest as well.
|
Yes i know you suggested it ;) but he had trouble reversing it.
|
Quote:
If the IP is suppose: 123.456.78.90 It should reverse it to 90.78.456.123 They way you suggest would make it 321.654.87.09 (i think), which I dont want to do. basically if the IP I need to get this -> 3092948441 when this is entered as IP -> 217.165.90.184 This is an example. |
Don't think too much ;)
It would already do that, i a review with the ip you now provided i found out that the sprintf is really neccesary to avoid negative numbers. PHP Code:
Code:
ip: 217.165.90.184 |
All times are GMT. The time now is 08:37 AM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|