Voting

: two plus zero?
(Example: nine)

The Note You're Voting On

Aleksey Kuznetsov
13 years ago
Unfortunately sprintf('%u', ...) is low and returns string representation of integer value instead of integer.
Here is a function I use to convert IP to mySQL-compatible signed integer:

function ip2int($ip) {
if (!$r = ip2long($ip)) return 0; // we want 0 instead of false, even in case of bad IP
if ($r > 2147483647)
$r-= 4294967296;
return $r; // ok
}

<< Back to user notes page

To Top