I am using GCM(Google could messaging) for the very first time and i am stuck with some problem. Although the problem has nothing to do with the GCM.I have a JSON data
$data='{"multicast_id":7917175795873320166,"success":6,"failure":0,"canonical_ids":4,
"results":[
{"registration_id":"3","message_id":"m1"},
{"message_id":"m1"},
{"message_id":"m1"},
{"registration_id":"3","message_id":"m1"},
{"registration_id":"3","message_id":"m1"},
{"registration_id":"3","message_id":"m1"}]}';
$newData=json_decode($data);
Now what i want is the keys in the result array for which registration_id is set but i am unable to do so.
I can access the registration_Id like $newData->results[0]->registration_id
I have found that array_keys() returns the keys in an array but how can i get the keys in the $newData->results
array for which $newData->results[$index]->registration_id
is set?
The major issue is that i cant use the foreach loop for doing it. Hope i will get some help here.