I need to get all the images of the tweets in the search, however when using isset to determine if extended_entities exists it converts my array to a string. How could I effectively detect that extended_entities exists? . Here is my code:
foreach ($tweets as $key => $tweet) {
if (isset($tweet->extended_entities->media)) {
foreach ($tweet->extended_entities->media as $key => $media) {
if ($media->type=="photo") {
$image[]=array(
"media_url"=>$media->media_url_https,
"media_w" =>$media->sizes->small->w,
"media_h" =>$media->sizes->small->h);
}
}
}else{
$image="no image";
}
}