I'm using the Giantbomb API, which returns results like so;
{
error: "OK",
limit: 100,
offset: 0,
number_of_page_results: 24,
number_of_total_results: 24,
status_code: 1,
results: [
{
expected_release_day: 8,
expected_release_month: 5,
name: "Project CARS",
platforms: [
{
api_detail_url: "http://www.giantbomb.com/api/platform/3045-94/",
id: 94,
name: "PC",
site_detail_url: "http://www.giantbomb.com/pc/3045-94/",
abbreviation: "PC"
},
],
site_detail_url: "http://www.giantbomb.com/project-cars/3030-36993/"
},
I can access the most information by using the standard json_decode, then iterating through the items using a for loop, but for some reason, I am having issues accessing the platforms array that is returned. I'm trying to get the name of a platform like so:
foreach($games['results'] as $item){
print $item['platforms']['name'];
but I always get "Undefined Index" errors when doing so. What am I doing wrong here?