Possible Duplicate:
How do I access this object property?
The data returned in a request is (JSON):
stdClass Object
(
[USD] => stdClass Object
(
[7d] => 23.3414
I'm calling:
json_decode(...);
And trying to access it via:
echo $json->USD->7d;
But that fails, because the variable name cannot start with an integer. Is there any syntax in PHP for accessing this?
Otherwise I would fix this by doing:
$set = (array) $json->USD;
echo $set['7d'];