I send a Facebook request using Graph api and i get the Array below as a result. However when i am trying to execute the code:
$a=count($Obj_1['events']->data);
I get the following message
Notice: Undefined index: events
I have tried everything like:
$Obj_1[0]->events->data
$Obj_1->events->data
$Object[0]->['events']->data
and googled anything trying to figure this out. I am trying to get rid of the Notice because the script runs as intended... Pls help :)
Array(
[events] => stdClass Object
(
[data] => Array
(
[0] => stdClass Object
(
[name] =>
[start_time] =>
[timezone] =>
[id] =>
)
)
[paging] => stdClass Object
(
)
)
[id] =>
)
Try replace: if print_r($Obj_1);
line do work then replace following.. From
$a=count($Obj_1['events']->data);
To
$tmpObj=$Obj_1["events"];
$a=count($tmpObj->data);