Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

PHP File Handling with PHP Parsing Specific Formats Conclusion

Dario Preglej
Dario Preglej
9,771 Points

@ in tags

Why are we using brackets () after attributes tag?

Example: $xml->channel->item[$random]->enclosure->attributes()->url

var_dump of that part in xml documentgs: object(SimpleXMLElement)#25 (1) { ["@attributes"]=> array(3) { ["url"]=> string(72) "http://traffic.libsyn.com/thegeekyfreelancer/FreeTheGeek-Episode0021.mp3" ["length"]=> string(8) "77471162" ["type"]=> string(11) "audio/x-mp3" } }

1 Answer

jamesjones21
jamesjones21
9,260 Points

basically, this is known as method chaining and you are calling on the method attribute() from within the class that is instantiated with the $xml object.

Hope this helps.