URL validation is widely used in PHP for checking if the user entered data is a valid url or not. In past, it was very difficult to match the url pattern with the user entered data by using regex techniques. But thanks to the PHP’s filter_var function which allows us to specify the type of data we want to match, and it will handle the rest of the work. This function returns true or false upon matching the required parameter. Here is its usage: