PHP代码ip2long 循环问题
print_r($dataIp);<br /> foreach ($dataIp as $key=>$value) {<br /> $data['ip'] = $value;<br /> $data['iplong'] = bindec(decbin(ip2long($value))); <br /> print_r($data); <br /> }
Array<br />(<br /> [ip] => 208.104.70.215<br /> [iplong] => 3496494807<br />)<br />Array<br />(<br /> [ip] => 74.101.176.171<br /> [iplong] => 1248178347<br />)<br />Array<br />(<br /> [ip] => 73.17.35.30<br /> [iplong] => 1225859870<br />)<br />Array<br />(<br /> [ip] => 70.198.197.3<br /> [iplong] => 1187431683<br />)<br />Array<br />(<br /> [ip] => 46.44.179.76<br /> [iplong] => 774681420<br />)<br /><br />
<br /><?php<br />$dataIp = array('208.104.70.215', '74.101.176.171', '73.17.35.30', '70.198.197.3', '46.44.179.76');<br /><br />foreach ($dataIp as $key=>$value) {<br /> $data['ip'] = $value;<br /> $data['iplong'] = bindec(decbin(ip2long($value))); <br /> print_r($data); <br />}<br />
<br />Array<br />(<br /> [ip] => 208.104.70.215<br /> [iplong] => 3496494807<br />)<br />Array<br />(<br /> [ip] => 74.101.176.171<br /> [iplong] => 1248178347<br />)<br />Array<br />(<br /> [ip] => 73.17.35.30<br /> [iplong] => 1225859870<br />)<br />Array<br />(<br /> [ip] => 70.198.197.3<br /> [iplong] => 1187431683<br />)<br />Array<br />(<br /> [ip] => 46.44.179.76<br /> [iplong] => 774681420<br />)<br />