public function filterVar($var) {
        $response = NULL;
        if (is_bool($var)) {
            $response = $var;
        } elseif(is_int($var)) {
            $response = $var;
        } elseif(is_float($var)) {
            $response = $var;
        }
        if($var != 'null') {
            if(is_string($var)) {
                $response = filter_var($var, FILTER_SANITIZE_SPECIAL_CHARS);            
            } elseif(is_array($var)) {
                $response = array();
                foreach ($var as $key => $value) {
                    if(is_array($value)) {
                        $response[$key] = $this->filterVar($value);
                    } else {
                        $response[$key] = filter_var($value, FILTER_SANITIZE_SPECIAL_CHARS);
                    }
                }
            }
        }
        return $response;
        
    }
public function filterVar($var) {
        $response = NULL;
        if (is_bool($var)) {
            $response = $var;
        } elseif(is_int($var)) {
            $response = $var;
        } elseif(is_float($var)) {
            $response = $var;
        }
        if($var != 'null') {
            if(is_string($var)) {
                $response = filter_var($var, FILTER_SANITIZE_SPECIAL_CHARS);            
            } elseif(is_array($var)) {
                $response = array();
                foreach ($var as $key => $value) {
                    if(is_array($value)) {
                        $response[$key] = $this->filterVar($value);
                    } else {
                        $response[$key] = filter_var($value, FILTER_SANITIZE_SPECIAL_CHARS);
                    }
                }
            }
        }
        return $response;
        
    }
public function filterVar ( $ var ) { $ response = NULL ; if ( is_bool ( $ var ) ) { $ response = $ var ; } elseif ( is_int ( $ var ) ) { $ response = $ var ; } elseif ( is_float ( $ var ) ) { $ response = $ var ; } if ( $ var != 'null' ) { if ( is_string ( $ var ) ) { $ response = filter_var ( $ var , FILTER_SANITIZE_SPECIAL_CHARS ) ; } elseif ( is_array ( $ var ) ) { $ response = array ( ) ; foreach ( $ var as $ key => $ value ) { if ( is_array ( $ value ) ) { $ response [ $ key ] = $ this -> filterVar ( $ value ) ; } else { $ response [ $ key ] = filter_var ( $ value , FILTER_SANITIZE_SPECIAL_CHARS ) ; } } } } return $ response ; }
Function to filter the input var. Is it define as public to replicate
the logic for every var that you want.

@param string $var
@return mixed sanitize var
Function to filter the input var . Is it define as public to replicate the logic for every var that you want .