1. 程式人生 > >PHP自帶函式ip、數字互轉

PHP自帶函式ip、數字互轉

$ip = '42.62.28.108';

$number = ip2long($ip); 將 IP 轉換成整型數字;

$newIp = long2ip($number); 將整型數字轉換成IP;

echo $number;

echo $newIp;