The filters also have the ability to cleanse data. For strings for example, they can remove the tags (x) HTML), a clean-mail address, a number or a URL. There are actually characters that are not allowed in email addresses.
The cleaning does not validate the data. It will only removes only the characters that you have not allowed even if there was no variable validity.
To validate a variable, use filter_var (). The latter is often called with two parameters, the variable to validate and filter type. However, it is also possible to use a third which is the array of options. It aims to return the value typecast if this is not the right type. The feature will allow FILTER_SANITIZE_URL meanwhile, clean the data as a link.