-2
我想寫一個函數,它將搜索多維數組中的值並返回祖父母的鍵。請參閱下面的數組層次結構。PHP搜索多維數組,用於祖父母的值和返回鍵
Array
(
[results] => Array
(
[quote] => Array
(
[0] => Array
(
[@attributes] => Array
(
[symbol] => VFORX
)
[LastTradePriceOnly] => 24.79
)
[1] => Array
(
[@attributes] => Array
(
[symbol] => VGSTX
)
[LastTradePriceOnly] => 21.77
)
[2] => Array
(
[@attributes] => Array
(
[symbol] => HPQ
)
[LastTradePriceOnly] => 21.00
)
)
)
)
例如,我要搜索的「符號」鍵爲值「HPQ」並返回任一的21.00的LastTradePriceOnly值或祖父母的關鍵是[2]。
在此先感謝您提供的任何幫助,以幫助我入門。
請開始寫您的最終一些代碼,以便我們可以建議一些 – 2013-03-09 19:22:07
是的,這是最適合你分享,你已經嘗試代碼。這將有助於社區幫助你。 – 2013-03-09 19:37:20