How do I loop different sections inside a landing page with php

Using the php SDK, I would like to get all the content for a landing page, this will include sections with different content types / components.


Section 1 - hero
Section 2 - article
Section 3 - image

Q. How do I loop through and get the linked section content.

If an entry contains a link to an asset or another entry, the SDK will automatically load it.

How exactly do I break into these values?

$query = new \Contentful\Delivery\Query();
->where("fields.urlHandle[match]", $slug);

$products = $client->getEntries($query);

foreach ($products as $product) {

echo $product['name'];

// Example of what I am trying to achieve
      $title= $product['sections']['hero']['title'];
      $text = $product['sections']['article']['text'];