Home > php教程 > php手册 > body text

PHP filter_var_array 实例教程

WBOY
Release: 2016-06-13 11:16:43
Original
1786 people have browsed it

 

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

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

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

语法

filter_var_array(array, args)
Copy after login
Copy after login
Copy after login
<!--?php$arr = array ( "name" =-->"peter griffin", "age" => "41", "email" => "peter@example.com", );
Copy after login
$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, );
Copy after login
print_r(filter_var_array($arr, $filters));?>
Copy after login
 
Copy after login
Copy after login
输出结果.
Copy after login
 
Copy after login
Copy after login
Copy after login
Copy after login
Array ( [name] => Peter Griffin [age] => 41 [email] => peter@example.com )
Copy after login

source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template