So got a slight problem that I've tried my best to solve but without success. I have a Facebook app that accesses checkin information and as such goes through the API which produces the JSON output in a multi-dimensional array. I'm coding in PHP.
Problem I've got is not every checkin has the coordinate/location information (latitude / longitude) so it will come back with an error on the page.
I want to go through the array of information and find out if the key exists and/or if there is any information contained within it.
foreach ($checkins['data'] as $checkin) {
echo ("<p>{$checkin['place']['location']['latitude']}</p>");
echo ("<p>{$checkin['place']['location']['longitude']}</p>");
}
That is the code I use but like I say if there isn't any location information I get an error. Does anyone know how I could solve this issue or is there an easy way of looping through and finding out if the specific keys exist?
Any help would be much appreciated!
Thank you!