Created
July 13, 2015 18:31
-
-
Save webkader/6afba79f9125af5295dc to your computer and use it in GitHub Desktop.
Check if a string is a valid url
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function isValidUrl($url) | |
{ | |
if (empty($url)) { | |
return false; | |
} | |
// only ASCII URL | |
if (filter_var($url, FILTER_VALIDATE_URL)) { | |
return true; | |
} else { | |
return false; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment