With the code below I need to make the area that I've labeled '$count ++' start at 0 and be able to count without limit. I have something there but not sure if I'm on the right path. Thanks <?php $response = file_get_contents($request); if ($response === false) { die('Request failed'); } $phpobj = unserialize($response); $content = ''; foreach ($phpobj['value']['items'] as $business) $content .= "{$business['0']['response']['LocationInfo']['neighborhood']['$count ++']['name']}"; echo $content; ?> PHP:
you must initialize the count first then increment every loop iteration, i dont get why you have a break there though, can you tell me what you want to achieve?
i forgot to delete that when i posted it... it was something i was toying with. I don't really understand what how to do what you're talking about but would it start like this: <?php $response = file_get_contents($request); if ($response === false) { die('Request failed'); } $phpobj = unserialize($response); $count = 0; $content = ''; foreach ($phpobj['value']['items'] as $business) $content .= "{$business['0']['response']['LocationInfo']['neighborhood']['$count ++']['name']}"; echo $content; ?> PHP:
ok, you can probably try this $content = ''; $count = 0; foreach ($phpobj['value']['items'] as $business) { $content .= "{$business['0']['response']['LocationInfo']['neighborhood'][$count]['name']}"; $count++; }