Let's say this code is executed after press the submit button in a form with purposes of sanitization:
<?php
$yourname = check_input(filter_input(INPUT_POST, 'yourname', FILTER_SANITIZE_STRING));
$email = check_input(filter_input(INPUT_POST, 'email', FILTER_SANITIZE_EMAIL));
$likeit = check_input(filter_input(INPUT_POST, 'likeit', FILTER_SANITIZE_STRING));
$comments = check_input(filter_input(INPUT_POST, 'comments', FILTER_SANITIZE_STRING));
function check_input($data) {
$data = trim($data) . stripslashes($data) . htmlspecialchars($data);
return $data;
}
?>
Taking in account that the filter_input function is being applied, is the check_input($data) function redundant in this case?