Home  >  Article  >  php教程  >  PHP filter_var_array 实例教程

PHP filter_var_array 实例教程

WBOY
WBOYOriginal
2016-06-13 11:16:431739browse

 

定义和用法
该filter_var_array ( )函数获得多个变量和它们选择的过滤器

这一功能是有益的过滤许多价值不要求filter_var ( ) ,多。

返回一个数组的价值观所要求的变量成功或FALSE的失败。

语法

filter_var_array(array, args)

<!--?php$arr = array ( "name" =-->"peter griffin", "age" => "41", "email" => "peter@example.com", );
$filters = array ( "name" => array  (  "filter"=>FILTER_CALLBACK,  "flags"=>FILTER_FORCE_ARRAY,  "options"=>"ucwords"  ), "age" => array  (  "filter"=>FILTER_VALIDATE_INT,  "options"=>array   (   "min_range"=>1,   "max_range"=>120   )  ), "email"=> FILTER_VALIDATE_EMAIL, );
print_r(filter_var_array($arr, $filters));?>
 
输出结果.
 

Array ( [name] => Peter Griffin [age] => 41 [email] => peter@example.com )

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Previous article:php strripos 函数教程Next article:常用php函数