php in_array is not working


php in_array is not working

你能在下面的代码中帮助我吗。在下面的代码中,In_array不起作用。

$d = "23232,54454,656565";
$data = explode(",", $d);
$pass = (isset($test['pass'][1]) ? $test['pass'][1] : '');
if(in_array($pass, $data)) {
  echo "exist";
} else {
  echo "Not Exist";
}

感谢

我测试了您的代码,并将下面的行放在上面,它就工作了:

$test['pass'][1] = '23232';

$test['pass'][1]为空,您会看到"不存在"消息