I call objects from Facebook of the new PHP SDK, and I break the objects as shown below, however, for two separate requests that I call the same, they do not return the same. The first query is returned as an array (hopefully). Second, it returns as an object, and for life I do not understand why.
$fb_session = new FacebookSession( $fb_session->getToken() );
$fb_user_array = (new FacebookRequest( $fb_session, 'GET', '/me' ))->execute()->getGraphObject()->asArray();
echo "FB USER >> A" . $fb_user_array['id'];
echo "FB USER >> B" . $fb_user_array->id;
$picture_array = (new FacebookRequest( $fb_session, 'GET', '/me/picture?type=large&type=square&redirect=false' ))->execute()->getGraphObject()->asArray();
echo "FB PIC >> A " . $picture_array['url'];
echo "FB PIC >> A " . $picture_array->url;
source
share