Exibir a lista drop-down

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]
);
?>
resultado
$mixed = [
  
'product_id' => 'libgd%3Cscript%3E',
  
'component' => [
    
=> 10,
  ],
  
'versions' => '2.0.33',
  
'doesnotexist' => NULL,
  
'testscalar' => false,
  
'testarray' => [
    
=> 2,
  ],
]
Exemplos
#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"]]])
Veja também
filter_input, filter_input_array, filter_var, pbx_callbacks