Validating URLs in PHP


Validate URLs to ensure they are in the correct format.

Source Code

if (filter_var($url, FILTER_VALIDATE_URL)) {
    echo "This URL is valid!";
} else {
    echo "Invalid URL!";
}
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments