Signatur
filter_input(int $type, string $var_name, int $filter = FILTER_DEFAULT, array|int $options = 0): mixed
Beschreibung
Types: INPUT_GET, INPUT_POST, INPUT_COOKIE, INPUT_SERVER, INPUT_ENV.
Parameter
| Name | Typ | Default | Beschreibung |
|---|---|---|---|
| $type Pflicht | int | — | Input-Quelle. |
| $var_name Pflicht | string | — | Key. |
| $filter | int | FILTER_DEFAULT | Filter. |
| $options | array|int | 0 | Optionen. |
Rückgabewert
Typ
mixed
Beschreibung
Gefilterter Wert.
Beispiele
Sichere Pagination
<?php
$page = filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT, [
'options' => ['default' => 1, 'min_range' => 1],
]);