這是我的數組$data
:如何檢查數值是否在我的數組中?
array(3) {
[0]=>
string(4) "icon"
[1]=>
string(6) " image"
[2]=>
string(12) " description"
}
我試圖找出一個值在我的數組現有:
if (in_array("description", $data))
{
echo "Match found";
}
else
{
echo "Match not found";
}
但我的結果是Match not found
我很茫然。
Downvoted,因爲它顯示在自我解決很少的努力,並在很大程度上是無助於未來的讀者。請考慮刪除此問題。 – mickmackusa