PHP filter is used to validate the data coming from different sources like the user’s input.
It is important part of a web application to test, validate the data coming from insecure sources.
We have different functions to validate the data:
filter_var();
filter_var_array();
filter input();
filter_input_array();
<?php
email_a = ‘user@website.com’;
if (filter_var($email_a, FILTER_VALIDATE_EMAIL)) {
echo “This (email_a) email address is considered valid.”;
//reported as valid
}
?>