我有数组这个输出,当我的print_r 从数据库比较数组逐个
$answer --> Array ([id] => 251 [question_id] => 242 [text] => something
[order] => 4 [deleted] => 0)
和阵列自带
//Array ([0] => 254 [1] => 251 [2] => 252 [3] => 253)
我需要的用户selectes莫名其妙地比较各数组答案来自分贝[id]=>251 to compare with [0] => 254
我可以使用什么,array_diff或相交或其他功能,谢谢
根据您的要求使用循环 –
您可以使用'array_values($ answer)'它返回具有整数索引的数组。因此您可以使用循环轻松进行比较。 – Niroshan
简单使用in_array'in_array($ answer ['id'],$ choose);' – JYoThI