Source Code:
(back to article)
<?php $url = "https://www.w3docs.com"; // Remove overall illegal characters from a URL $url = filter_var($url, FILTER_SANITIZE_URL); // Validate url if (!filter_var($url, FILTER_VALIDATE_URL) === false) { echo "$url is a valid URL"; } else { echo "$url is not a valid URL"; } ?>
Result:
Report an issue