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 9131343
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:07:35+00:00 2026-06-17T08:07:35+00:00

I feel rather stupid for asking this, but how is it that this foreach

  • 0

I feel rather stupid for asking this, but how is it that this

       foreach ($fbuser['feed']['data'] as $fbmsg){

            var_dump($fbmsg['message']);
            die;

produces the exact result I want, it shows me the contents of the array key ‘message’…

…while this throws an error stating that the key ‘message’ is undefined…

       foreach ($fbuser['feed']['data'] as $fbmsg){

           $r .= '<tr><td class="fb_td"><img src="https://graph.facebook.com/'.$fbmsg['from']['id'].'/picture" class="fb_img"></td><td>'.
                     ' <i>'.$fbmsg['from']['name'].'</i><br>'.
                     $fbmsg['message'].'</td></tr>';
      }

Here is the var_dump, clearly containing a [‘message’] key…

array(19) { ["id"]=> string(28) "167669502405_366091400140059" ["from"]=> array(3) { ["category"]=> string(21) "Professional services" ["name"]=> string(9) "Warp Nine" ["id"]=> string(12) "167669502405" } ["message"]=> string(47) "Nu finns Warp Nine's annons på pizzakartonger!" ["story"]=> string(40) "Warp Nine shared Annonspizza AB's photo." ["story_tags"]=> array(2) { [0]=> array(1) { [0]=> array(5) { ["id"]=> string(12) "167669502405" ["name"]=> string(9) "Warp Nine" ["offset"]=> int(0) ["length"]=> int(9) ["type"]=> string(4) "page" } } [17]=> array(1) { [0]=> array(5) { ["id"]=> string(15) "182446165166120" ["name"]=> string(14) "Annonspizza AB" ["offset"]=> int(17) ["length"]=> int(14) ["type"]=> string(4) "page" } } } ["picture"]=> string(83) "http://photos-d.ak.fbcdn.net/hphotos-ak-ash4/384287_370171156393619_242673100_s.jpg" ["link"]=> string(105) "http://www.facebook.com/photo.php?fbid=370171156393619&set=a.347118762032192.78549.182446165166120&type=1" ["name"]=> string(15) "Timeline Photos" ["caption"]=> string(88) "Vi har även något att läsa då vi äter pizzan. Såhär ser kartongen ut på insidan!" ["properties"]=> array(1) { [0]=> array(3) { ["name"]=> string(2) "By" ["text"]=> string(14) "Annonspizza AB" ["href"]=> string(71) "http://www.facebook.com/pages/Annonspizza-AB/182446165166120?ref=stream" } } ["icon"]=> string(59) "http://static.ak.fbcdn.net/rsrc.php/v2/yD/r/aS8ecmYRys0.gif" ["privacy"]=> array(1) { ["value"]=> string(0) "" } ["type"]=> string(5) "photo" ["status_type"]=> string(12) "shared_story" ["object_id"]=> string(15) "370171156393619" ["application"]=> array(2) { ["name"]=> string(6) "Photos" ["id"]=> string(10) "2305272732" } ["created_time"]=> string(24) "2012-10-04T21:05:55+0000" ["updated_time"]=> string(24) "2012-10-04T21:05:55+0000" ["comments"]=> array(1) { ["count"]=> int(0) } }
  • 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-06-17T08:07:36+00:00Added an answer on June 17, 2026 at 8:07 am

    If you have three arrays inside of $fbuser['feed']['data'] and array1 has a message key but array2 and array3 do not then you will receive an error.

    Try:

    foreach ($fbuser['feed']['data'] as $fbmsg){
        $r .= '<tr><td class="fb_td"><img src="https://graph.facebook.com/'.$fbmsg['from']['id'].'/picture" class="fb_img"></td><td>'.
                 ' <i>'.$fbmsg['from']['name'].'</i><br>'.
                 (isset($fbmsg['message'])?$fbmsg['message']:'').'</td></tr>';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I feel rather stupid for asking this but I'll do it anyway. The 'Users'
I feel silly for asking, but how do I get plan value in this
I feel like such a noob asking this but, for some reason a horizontal
I feel like this is a rather simple question, but I can't seem to
I've written this documentation of a rather simple class, but I feel it's not
I feel like there's a nicer name for this that i don't know, but
This is very simple, but I'm being rather stupid about it. I have a
I feel rather silly actually asking this question as I am sure it will
I feel like a dork just for asking this, but I'm not getting any
I feel rather foolish as this is just a short question. I was reading

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.