Reputation: 33
I'm getting this object with JSON and getting name by using
$programItem[0]->Name
but if I try to use
$programitem[0]->@id
This does not work I think because of the @ but I can't remove this, anyway I can get this working?
[0] => stdClass Object
(
[@id] => 123
[name] => Companyname
)
Upvotes: 3
Views: 46
Reputation: 31644
You can also use a variable variable to get to it
$var = '@id';
echo $a->$var;
Upvotes: 0
Reputation: 6836
You can get it like
echo $obj->{'@stuff'};
See a working example:
Upvotes: 2