note 129912 added to function.filter-input-array
| From: | kernamon.workstation@gmail.com | Date: | Fri, 13 Dec 2024 12:56:43 +0000 |
| Subject: | note 129912 added to function.filter-input-array | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221717@lists.php.net to get a copy of this message | ||
filter_input_array() function is similar but it is typically used for filtering input data coming
from external sources like $_GET $_POST or $_REQUEST
SINTAX:
filter_input_array(int $type, array $filters, bool $add_empty = true): array|false
EXAMPLE:
// Example of using filter_input_array() to filter GET input
$filters = [
'email' => FILTER_VALIDATE_EMAIL,
'age' => FILTER_VALIDATE_INT
];
// Filter input from the GET request
$filtered_input = filter_input_array(INPUT_GET, $filters);
print_r($filtered_input);
CONCLUSION:
Above code filters the email and age values from the $_GET array. It validates the email as an email
address and the age as an integer.
----
Server IP: 45.112.84.4
Probable Submitter: 80.90.5.137 (proxied: 193.49.48.244)
----
Manual Page -- https://php.net/manual/en/function.filter-input-array.php
Edit -- https://main.php.net/note/edit/129912
Del: integrated -- https://main.php.net/note/delete/129912/integrated
Del: useless -- https://main.php.net/note/delete/129912/useless
Del: bad code -- https://main.php.net/note/delete/129912/bad+code
Del: spam -- https://main.php.net/note/delete/129912/spam
Del: non-english -- https://main.php.net/note/delete/129912/non-english
Del: in docs -- https://main.php.net/note/delete/129912/in+docs
Del: other reasons-- https://main.php.net/note/delete/129912
Reject -- https://main.php.net/note/reject/129912
Search -- https://main.php.net/manage/user-notes.php