【发布时间】:2015-02-24 18:34:29
【问题描述】:
3 php 常量我不知道他们做了什么
1。 FILTER_REQUIRE_ARRAY
The name says it all I can agree no more but there is a function called
<em>filter_var/input_array()</em> which works in similar fashion;
I've seen examples where recursive validation is required but
not all element in the array are arrays some items are just scalar value
FILTER_REQUIRE_SCALAR
<?php
$x = 5;
$y = [1, 2, 3];
var_dump(filter_var($x,FILTER_REQUIRE_SCALAR));
var_dump(filter_var($y,FILTER_REQUIRE_SCALAR));
?>
考虑产生
bool(false)
bool(false)
的 prev 代码作为使用可以看到 $x 确实是 Scalar强>
FILTER_FORCE_ARRAY
总是返回一个数组这是我在phpDoc找到的所有文档请给我一个关于这个的例子
【问题讨论】: