php - How to integrate a foreach with a complicated JSON?

one text

Solution:

Change $results= json_decode($results); to $results= json_decode($results, true);. That will change it from an object to an array

From: https://www.php.net/manual/en/function.json-decode.php "When TRUE, returned objects will be converted into associative arrays."

Source