[英]PHP in_array returning wrong value
Here is the one value that can not determine PHP in_array
function. 这是一个无法确定PHP
in_array
函数的值。 I think this is issue with value but why ? 我认为这是有价值的问题,但是为什么呢? I am stuck.
我被困住了。
"ZQjEa8EsL2kdHr2xD2jkoWj678FWsLL2Ng1tFjDV/Rgkt0CLiE4f+lvlYrdDjvq2"
PHP Example PHP示例
<?php
$id = "ZQjEa8EsL2kdHr2xD2jkoWj678FWsLL2Ng1tFjDV/Rgkt0CLiE4f+lvlYrdDjvq2";
$array['selected_options']['12251_12754_3'][0] = 0;
var_dump(in_array($id, $array['selected_options']['12251_12754_3']));
?>
Output 产量
true
Question : Anybody knows why this happen or what I do instead ?
问题:有人知道为什么会发生这种情况还是我会怎么做?
Answers much appriciated ! 答案多多贴切!
Searches for needle in haystack using loose comparison unless strict is set.
除非已设置严格,否则使用松散比较在大海捞针中搜索针。
Append the third argument with true to get the result you need. 将第三个参数附加为true以获得所需的结果。
var_dump(in_array($id, $array['selected_options']['12251_12754_3'], true));
See documentation . 请参阅文档 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.