Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,248 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.