如何回显此数组的值?

时间:2015-07-13 08:13:35

标签: php arrays class object foreach

如何在php中使用 foreach 回显此数组的内容?我需要的东西是Array [0]和[1]的结果,身份等。有人可以帮忙吗?

stdClass Object ( [GetRealTimeRatesResult] => stdClass Object ( [Rate]
=> Array ( [0] => stdClass Object ( [Outcome] => Success [Identity] => Header [Delay] => 0.0067521 [BaseCurrency] => EUR [QuoteCurrency] => USD [Symbol] => EURUSD [Date] => 07/13/2015 [Time] => 8:07:38 AM [QuoteType] => Spot [Bid] => 1.10595 [Mid] => 1.105995 [Ask] =>
1.10604 [Spread] => 9.0E-5 [Text] => 1 European Union euro = 1.105995 United States dollars [Source] => SIX Financial Information, Buyer = "ZKB Zuercher Kantonalbank, Devisen", Seller = "ZKB Zuercher Kantonalbank, Devisen" ) [1] => stdClass Object ( [Outcome] => Success [Delay] => 0 [BaseCurrency] => AUD [QuoteCurrency] => USD [Symbol] => AUDUSD [Date] => 07/13/2015 [Time] => 8:07:38 AM [QuoteType] => Spot [Bid] => 0.74166 [Mid] => 0.741705 [Ask] => 0.74175 [Spread] => 9.0E-5 [Text] => 1 Australian dollar = 0.741705 United States dollar [Source]
=> SIX Financial Information, Buyer = "ZKB Zuercher Kantonalbank, Devisen", Seller = "ZKB Zuercher Kantonalbank, Devisen" ) ) ) )

解决:

foreach($result->GetRealTimeRatesResult->Rate as $row){
    echo $row->Outcome;
}

0 个答案:

没有答案