【发布时间】:2018-07-10 10:35:10
【问题描述】:
in_array 函数有问题。
这是我的array:键可以是字符串或整数的混合,就像这个例子一样。
<?php
$array = array(
"a" => true,
"b" => true,
"c" => true,
"d" => true,
0 => "Code",
1 => "Time",
2 => "Other"
);
var_dump($array);
if ( in_array("Test", $array) ) { echo "found"; }
此代码始终打印found。
为什么?
【问题讨论】: