PHP Filter Functions

About This Index
This page is the PHP Filter Functions index for the tutorial track. Each row links to a full guide with syntax, examples, and FAQs.
Learn what the filter extension is and how to validate and sanitize input on /php/filter. Use this page when you need a specific helper such as filter_var(), filter_input(), or filter_var_array().
Start with filter_var() and filter_input()—then browse the array helpers and the check and list functions.
How to Call a Filter Function
Filter helpers are global functions—pass a value (or an input type) and a FILTER_* constant:
$email = filter_var($input, FILTER_VALIDATE_EMAIL);
if ($email === false) {
echo 'Invalid email';
}
// From a request source
$page = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT); PHP Filter Functions Table
All function guides in this PHP tutorial series (7 tutorials in 4 categories).
Check & list
3 functionsCheck that an input variable exists and discover which filters PHP supports.
| Function | Description | Tutorial |
|---|---|---|
filter_has_var() | Check if a variable of a specified input type exists. | Try it |
filter_id() | Return the filter ID for a filter name. | Try it |
filter_list() | Return a list of all supported filter names. | Try it |
Filter a value
1 functionValidate or sanitize a single value you already hold in a variable.
| Function | Description | Tutorial |
|---|---|---|
filter_var() | Filter a variable with a specified filter. | Try it |
Filter input sources
1 functionRead one variable straight from GET, POST, cookies, server, or environment and filter it.
| Function | Description | Tutorial |
|---|---|---|
filter_input() | Get a specific external variable by name and optionally filter it. | Try it |
Filter arrays
2 functionsFilter many values at once with a single definition, from an input source or from an array.
| Function | Description | Tutorial |
|---|---|---|
filter_input_array() | Get external variables and optionally filter them. | Try it |
filter_var_array() | Get multiple variables and optionally filter them. | Try it |
Frequently Asked Questions
Start with filter_has_var()
Open the first guide—syntax, examples, and FAQs.
15 people found this page helpful
