Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 927851
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T19:55:06+00:00 2026-05-15T19:55:06+00:00

I have this piece of code which works 90% of the time: $user_details=$fb->api_client->users_getInfo($fb_user, array(‘last_name’,’first_name’,’proxied_email’));

  • 0

I have this piece of code which works 90% of the time:

$user_details=$fb->api_client->users_getInfo($fb_user, array('last_name','first_name','proxied_email'));
$firstName=$user_details[0]['first_name'];

But sometimes I get this error:

Fatal error: Cannot use string offset as an array for line
$firstName=$user_details[0]['first_name'];

I have read several people report the same issue – but I’m still not clear as to what is the reason – Am I getting this error because facebook is not returning any results or am I getting because it is returning only a single array instead of array of arrays.

This is the fix I’m thinking of:

if (!is_array($user_details)) {
$firstName='';
}
else
{
$firstName = ($user_details[0]) ? $user_details[0]['first_name'] : $user_details['first_name'];
}

Also if I’m not getting the name – is it because of a timeout issue or something else?

Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T19:55:07+00:00Added an answer on May 15, 2026 at 7:55 pm
    $user_details=$fb->api_client->users_getInfo($fb_user, array('last_name','first_name','proxied_email'));
                if (!is_array($user_details)) {
                    $firstName='';
                    $lastName='';
                }
                else
                {
                    $firstName = ($user_details[0]) ? $user_details[0]['first_name'] : $user_details['first_name'];
                    $lastName = ($user_details[0]) ? $user_details[0]['last_name'] : $user_details['last_name'];
                }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this little piece of jQuery/jqModal code which works fine. However, I am
I have this piece of code which works in Firefox link = $('<a>link</a>'); var
I have this piece of code which I'm hoping will be able to tell
I am somewhat new to R, and i have this piece of code which
Ok i have this piece of code from which i took from W3schools :-
I have this piece of Open MP code here which performs an integeration of
I have this piece of code: if(($op == q)); then which throws out this
I have this piece of code that works fine in subsonic 2.2, I migrated
I have a piece of code which works in a way that is unexpected
I have this piece of code which i am using on another area of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.