在SimpleXMLElement中获取前缀为'@'的值[复制]

This question already has an answer here:

I have this line of code:

print_r($item->figure->iframe);

Which produces this output:

SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [height] => 288
            [mozallowfullscreen] => true
            [src] => http://www.hulu.com/embed.html?eid=Bq_uuy5X4KWFpYZgwa9e9g
            [allowfullscreen] => true
            [width] => 512
            [frameborder] => 0
            [scrolling] => 0
            [webkitAllowFullScreen] => true
        )

)

I then try this:

var_dump($item->figure->iframe->{'@attributes'}["src"]);

Which then gives me this:

NULL

What am I doing wrong? I want to get the src item, why can't I get it?

</div>
var_dump($item->figure->iframe->attributes());

http://php.net/manual/en/simplexmlelement.attributes.php