我有數組這個輸出,當我的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