显示下拉菜单

filter_var_array()

« filter_var | floatval »
<?php
// custom callback functions
function cube($n)       { return($n $n $n); }
function 
double($value) { return $value 2; }

// adds custom callback functions, closures and methods
require "pbx_callbacks.php";
$object = new pbx_callbacks();

$mixed filter_var_array (
    
// array $data
    
// [mixed $definition]
    
?  // [bool $add_empty = true]
);
?>
结果
$mixed = [
  
'width' => '2',
  
'length' => '3',
  
'height' => '4',
  
'weight' => '5',
]
示例
#1 filter_var_array  (["product_id" => "libgd<script>""component" => "10""versions" => "2.0.33""testscalar" => [=> "2"=> "23"=> "10"=> "12"], "testarray" => "2"],
 [
"product_id" => FILTER_SANITIZE_ENCODED"component" => ["filter" => FILTER_VALIDATE_INT"flags" => FILTER_FORCE_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_FORCE_ARRAY]])
#2 filter_var_array  (["width" => 2"length" => 3"height" => 4"weight" => 5],
 [
"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"]]])
另请参阅
call_user_func, filter_input, filter_input_array, filter_var, pbx_callbacks