Reputation: 841
I have these data formats of objects in php.
stdClass Object
(
[@attributes] => stdClass Object
(
[currency] => JPY
[rate] => 136.07
)
)
How can I get currency and rate from this object? Thanks in advance..
Upvotes: 0
Views: 66
Reputation: 218
if that so you can just call
$object->attributes()->currency;
Upvotes: 0
Reputation: 1112
If that object is named $obj, it's $currencyValue=$obj->{'@attributes'}->currency;
Upvotes: 2
Reputation: 3027
Try these.. ..presuming that you are using SimpleXML to parse the data.
$currency = $object->attributes()->currency;
$rate = $object->attributes()->rate;
Upvotes: 0