note 103649 deleted from function.filter-var by mazzanet
| From: | mazzanet@php.net | Date: | Tue, 26 Apr 2011 10:24:28 +0000 |
| Subject: | note 103649 deleted from function.filter-var by mazzanet | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179157@lists.php.net to get a copy of this message | ||
Note Submitter: Yousef Ismaeil
----
<?php
/**
* By Yousef Ismaeil - cliprz@gmail.com
* filter url with regex
*/
function check_url($url)
{
$pattren = "|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i";
if (preg_match($pattren,$url))
{
return true;
}
else
{
return false;
}
}
// used
if (!check_url("hddp://w.3.a"))
{
echo 'this is not url';
}
?>