Retrieving array keys from JSON input
I was not satisfied with other answers so I add my own. I believe the most general approach is:
$array = get_object_vars($json->entries[0]);foreach($array as $key => $value) { echo $key . "<br>";}
where I used entries[0]
because you assume that all the elements of the entries
array have the same keys.
Have a look at the official documentation for key
: http://php.net/manual/en/function.key.php