How do you access a PHP object that has a #
in the $key name?
Example:
[image] => stdClass Object
(
开发者_Python百科 [#text] => http://userserve-ak.last.fm/serve/_/85003/Red+Hot+Chili+Peppers.jpg
[name] => original
[width] => 937
[height] => 1276
)
I want to access the #text
property, but $image->#text
doesn't work because PHP interprets the #
as the start of a comment.
How do I do this?
You can try with:
$image->{'#text'}
maybe like this: (not sure)
$image->{"#text"}
One way is to use variable key names:
$keyname = '#text';
$value = $image->$keyname;
精彩评论