Display the drop-down list

filter_input_array()

« filter_input | filter_list »
<?php
? 
=
    
// array $data

$mixed filter_input_array (
    
?// int $type
    
// [mixed $definition]
    
?  // [bool $add_empty = true]
);

// note that filter_input_array() only uses the data passed to the script
// subsequent changes, as in this example, would actually be ignored
// filter_input_array() is emulated with filter_var_array() in this example

// see filter_var_array() for more examples including callbacks
?>
Result
$mixed = [
  
'width' => '2',
  
'length' => '3',
  
'height' => '4',
  
'weight' => '5',
]
Examples
#1 filter_input_array  (/* $predefined_var = $_POST */
 /* $data = ["product_id" => "libgd<script>", "component" => "10", "versions" => "2.0.33", "testscalar" => [0 => "2", 1 => "23", 2 => "10", 3 => "12"], "testarray" => "2"] */
 
INPUT_POST,
 [
"product_id" => FILTER_SANITIZE_ENCODED"component" => ["filter" => FILTER_VALIDATE_INT"flags" => FILTER_REQUIRE_ARRAY"options" => ["min_range" => 1"max_range" => 10]], "versions" => FILTER_SANITIZE_ENCODED"doesnotexist" => FILTER_VALIDATE_INT"testscalar" => ["filter" => FILTER_VALIDATE_INT"flags" => FILTER_REQUIRE_SCALAR], "testarray" => ["filter" => FILTER_VALIDATE_INT"flags" => FILTER_REQUIRE_ARRAY]])
#2 filter_input_array  (/* $predefined_var = $_GET */
 /* $data = ["product_id" => "libgd<script>", "component" => "10", "versions" => "2.0.33", "testscalar" => [0 => "2", 1 => "23", 2 => "10", 3 => "12"], "testarray" => "2"] */
 
INPUT_POST,
 [
"product_id" => FILTER_SANITIZE_ENCODED])
#3 filter_input_array  (/* $predefined_var = 123 */
 /* $data = ["product_id" => "libgd<script>", "component" => "10", "versions" => "2.0.33", "testscalar" => [0 => "2", 1 => "23", 2 => "10", 3 => "12"], "testarray" => "2"] */
 
INPUT_POST,
 [
"product_id" => FILTER_SANITIZE_ENCODED])
#4 filter_input_array  (/* $predefined_var = $_GET */
 /* $data = ["width" => 2, "length" => 3, "height" => 4, "weight" => 5] */
 
INPUT_GET,
 [
"width" => ["filter" => FILTER_CALLBACK"options" => "double"], "length" => ["filter" => FILTER_CALLBACK"options" => $cube], "height" => ["filter" => FILTER_CALLBACK"options" => "pbx_callbacks::double"], "weight" => ["filter" => FILTER_CALLBACK"options" => [=> $object=> "cube"]]])
See also
call_user_func, filter_input, filter_var_array