I have some json object that I decoded, and one of the attributes starts with an "@" and I can't access the element with php because it throws an error.
[offers] => stdClass Object
(
[@attributes] => stdClass Object
(
[id] => levaka0B8a
)
)
How would I go about accessing attributes?
Try to use,
Sample Code to Refer
You can access it by a string:
Or a variable:
For more information on how variables are defined and used, see the following docs:
You could do this:
direct access is below from ircmaxwell or Richard Tuin, however you can decode JSON with second param true and recive array insted what could be an easier to access