note 18208 deleted from function.ip2long by sniper
| From: | sniper@php.net | Date: | Sat, 20 Sep 2003 07:50:18 +0000 |
| Subject: | note 18208 deleted from function.ip2long by sniper | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-56800@lists.php.net to get a copy of this message | ||
Note Submitter: oliver@samera.com.py
----
Here is a simple way to check if a given IP is valid:
function valid_ip($ip)
{
if(!is_string($ip))
return false;
$ip_long = ip2long($ip);
$ip_reverse = long2ip($ip_long);
if($ip == $ip_reverse)
return true;
else
return false;
}