note 129911 added to function.filter-var-array

From: Date: Fri, 13 Dec 2024 12:53:09 +0000
Subject: note 129911 added to function.filter-var-array
Groups: php.notes 
Request: Send a blank email to php-notes+get-221716@lists.php.net to get a copy of this message
filter_var_array() function is used to filter multiple variables at once, by validating and sanitizing user input, particularly when you need to handle an array of data. SINTAX: filter_var_array(array $data, array $filters): array|false EXAMPLE: $data = [ 'email' => 'user@example.com', 'url' => 'http://example.com', 'age' => '25' ]; $filters = [ 'email' => FILTER_VALIDATE_EMAIL, 'url' => FILTER_VALIDATE_URL, 'age' => FILTER_VALIDATE_INT ]; $filtered_data = filter_var_array($data, $filters); print_r($filtered_data); CONCLUSION: In the above example, filter_var_array() validates the email, URL and age fields according to the specified filters. Returns an array of filtered values or false if validation fails. ---- 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-var-array.php Edit -- https://main.php.net/note/edit/129911 Del: integrated -- https://main.php.net/note/delete/129911/integrated Del: useless -- https://main.php.net/note/delete/129911/useless Del: bad code -- https://main.php.net/note/delete/129911/bad+code Del: spam -- https://main.php.net/note/delete/129911/spam Del: non-english -- https://main.php.net/note/delete/129911/non-english Del: in docs -- https://main.php.net/note/delete/129911/in+docs Del: other reasons-- https://main.php.net/note/delete/129911 Reject -- https://main.php.net/note/reject/129911 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#221716) next »