[英]phph in_array does not find record
I am using in_array but it is coming back that that data I give it is not in the array although it should. 我正在使用in_array,但它回来说我给它的数据不在数组中,尽管它应该。
cant see what I am missing? 不知道我错过了什么?
the array 数组
array(3) {
["MonthlyReturn"]=> array(11) { ["id"]=> string(3) "307" ["employee_id"]=> string(3) "553" }
["Company"]=> array(13) { ["id"]=> string(3) "160" ["member_number"]=> string(1) "2" ["name"]=> string(5) "ger 2" }
["Employee"]=> array(15) { ["id"]=> string(3) "553" ["company_id"]=> string(3) "160" ["first_name"]=> string(4) "pepe" }
The php code PHP代码
$employee = 554;
if (in_array($employee, (array)$existingReturns['MonthlyReturn']['employee_id'])){
Cause it is not an array. 因为它不是一个数组。 Why just you don't check like this,
为什么你不这样检查,
if ($employee == $existingReturns['MonthlyReturn']['employee_id'])
$existingReturns['MonthlyReturn']
是数组,而$existingReturns['MonthlyReturn']['employee_id']
是一个字符串
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.