Code Snippet
URL Validation
$url = 'http://example.com';
$validation = filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED);
if ( $validation ) $output = 'proper URL';
else $output = 'wrong URL';
echo $output;
$url = 'http://example.com';
$validation = filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED);
if ( $validation ) $output = 'proper URL';
else $output = 'wrong URL';
echo $output;
$output = ‘proper UL’;
I think there is a typo in that line.
I think it needs improvements. The code will pass the url “http://www.example” as valid url.