I have a form with a lot of variables which is then sending an email, rather than sanitizing each $_POST value with filter_var($_POST[\'var\'], FILTER_SAN
If the type of each of your input variables is a string and you want to sanitize them all at once, you can use:
// prevent XSS
$_GET = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
$_POST = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
This will sanitize your $_GET and $_POST arrays.
Seen here: PHP -Sanitize values of a array