English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
The ip2long() function converts a string internet protocol (IPV4) to a long integer.
int ip2long ( string $ip_address )
It is used to convert an IPv4 address to a long integer.
Returns the numeric representation of the IP address after conversion or FALSE if ip_address is invalid.
Serial number | Parameters and descriptions |
---|---|
1 | ip_address It contains an IP address. |
Try the following example
<?php $ip = gethostbyname('ru.oldtoolbag.com'); $out = "The following three URLs are equivalent:" \n"; $out .= 'http://ru.oldtoolbag.com/, http://' . $ip . '/ And http://' . sprintf("眻, ip2long($ip)) . "/" \n"; echo $out; ?>
Output result
The following three URLs are equivalent: http://ru.oldtoolbag.com/, http://39.107.75.220/, http://661343196/