标签:exp pre for echo array imp print ipa 3.1
$ipArr = explode(‘.‘,‘139.86.23.139‘);
print_r($ipArr);
$ip = $ipArr[0] * 0x1000000
+ $ipArr[1] * 0x10000
+ $ipArr[2] * 0x100
+ $ipArr[3];
echo $ip.‘<br>‘;
$ipVal =$ip;
$ipArr = array(0 =>
floor( $ipVal / 0x1000000) );
$ipVint = $ipVal-($ipArr[0]*0x1000000); // for clarity
$ipArr[1] = ($ipVint & 0xFF0000) >> 16;
$ipArr[2] = ($ipVint & 0xFF00 ) >> 8;
$ipArr[3] = $ipVint & 0xFF;
$ipDotted = implode(‘.‘, $ipArr);
echo $ipDotted;
---------------------------------------------------
int() 精度丢失
$a = (0.1 + 0.7) *10;
echo (int) $a; // 7 int
echo var_dump($a) //8 float
标签:exp pre for echo array imp print ipa 3.1
原文地址:https://www.cnblogs.com/opzx/p/9974727.html