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 Reading JSON

Artan Muzhaqi
Artan Muzhaqi
7,983 Points

Why do you use $books->collections what's that for ?

why don't we just use $books->title

Julien Steel
Julien Steel
10,790 Points

If you look at the JSON file you'll see that the object collections contains the array books

{
    "collection": {
        "books": [
            {
                "title": "Sams Teach Yourself SQL\u2122 in 10 Minutes",
                "link": "https://www.goodreads.com/review/show/1874591524?utm_medium=api&utm_source=rss",
                "book_image_url": "https://images.gr-assets.com/books/1348383230s/173346.jpg",
                "book_description": "Offering a tutorial to the themes and techniques involved in applying the SQL language, this book includes coverage of versions of major commercial SQL platforms. It also covers MySQL, and PostgreSQL. It contains examples which have been tested against each SQL platform, with incompatibilities or platform distinctives called out and explained.",
                "num_pages": "242",
                "author_name": "Ben Forta",
                "isbn": "0672325675",
                "average_rating": "3.90",
                "book_published": "1999"
            },