php - How does iptolong work -


as know long2ip works ip1.ip2.ip3.ip4 (123.131.231.212)

long ip => (ip1 * 256 * 256 * 256) + (ip2 * 256 * 256) + (ip3 * 256) + ip4 2072242132 => (123 * 256 * 256 * 256) + (131 * 256 * 256) + (231 * 256) + 212 

but pseudo code converting number ip address?

also suitable way store ip addresses in mysql traffic analytics website have on 500 ip lookups per second?

would better if table unique ids created every single ip , used lookups?

thanks

$long = ip2long("123.131.231.212");  $ip = array(); array_unshift($ip, $long & 0xff); array_unshift($ip, ($long >>= 8) & 0xff); array_unshift($ip, ($long >>= 8) & 0xff); array_unshift($ip, ($long >>= 8) & 0xff);  // $ip = // array // ( //     [0] => 123 //     [1] => 131 //     [2] => 231 //     [3] => 212 // ) 

Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -