鍵值對我有如下數組:檢查多維數組
Array
(
[0] => Array
(
[type] => foo
)
[1] => Array
(
[type] => bar
)
[2] => Array
(
[type] => bar
)
)
和需要知道,如果存在一個或多個type
哪個值bar
,沒有做到這一點:
foreach ($arrayOfTypes as $type) {
if ($type['type'] == 'bar')
{
// Stuff here
}
}
(僅用於學習目的)