php sanitize 24post

Solutions on MaxInterview for php sanitize 24post by the best coders in the world

showing results for - "php sanitize 24post"
Nolhan
04 Jan 2018
1//If the type of each of your input variables is a string and 
2//you want to sanitize them all at once, you can use:
3$_GET   = filter_input_array(INPUT_GET, FILTER_SANITIZE_STRING);
4$_POST  = filter_input_array(INPUT_POST, FILTER_SANITIZE_STRING);
5//or 
6filter_var($_POST['message'], FILTER_SANITIZE_STRING);
7//or
8function util_array_trim(array &$array, $filter = false)
9{
10    array_walk_recursive($array, function (&$value) use ($filter) {
11        $value = trim($value);
12        if ($filter) {
13            $value = filter_var($value, FILTER_SANITIZE_STRING);
14        }
15    });
16
17    return $array;
18}