Home > Article > Backend Development > PHP function ip2long() implements a solution to the problem of negative numbers when converting IP to integer
Reason: The integer value converted by IP is too large and exceeds the range of the integer, so it becomes a negative number. You need to make the following modifications, modify it to $ip_n = bindec(decbin(ip2long($ip))) to get the unsigned integer. For example:
|