我有一個PHP數組像這樣(沒有語法)數組元素:PHP:使用某些關鍵
array
(
['one'] => array (
['wantedkey'] => 5
['otherkey1'] => 6
['otherkey2'] => 7
)
['two'] => => array (
['otherkey1'] => 5
['otherkey2'] => 6
['wantedkey'] => 7
)
['three'] => => array (
['otherkey1'] => 5
['wantedkey'] => 6
['otherkey2'] => 7
)
)
什麼是打印值只與'wantedkey'
一個關鍵要素的最佳方式,如果我例如使用array_walk_recursive
?
謝謝!
道歉,我忘了提,如果我要檢查,如果鍵是在多維的方式是相同的: '$項目[「wantedkey1」] [「wantedkey2」]' 如何確保兩個鑰匙都存在? – ash 2009-12-23 18:52:36