note 36177 rejected from function.explode by pollita
| From: | pollita@php.net | Date: | Mon, 29 Sep 2003 21:10:32 +0000 |
| Subject: | note 36177 rejected from function.explode by pollita | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-57297@lists.php.net to get a copy of this message | ||
Note Submitter: bkreleger at phphulp dot nl
----
You can also use explode for an IP adress to check it for validation.
<?
$ipaddr = "some ip adress";
$ipslize = explode(".", $ipaddr);
for ($i = 0; $i <= 3; $i++)
{
if (!is_numeric($ipslize[$i]))
$err = 1;
}
if (strlen($ipaddr) >= 15 && !$err)
{
echo "Valid IP adress";
}
else
{
echo "Non valid IP adres";
}
?>