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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T05:28:57+00:00 2026-05-31T05:28:57+00:00

All, I’m using a function like this: function themeblvd_twitter_slider_default( $tweet, $options, $username ) {

  • 0

All,
I’m using a function like this:

function themeblvd_twitter_slider_default( $tweet, $options, $username ) {
    echo $tweet[0]->text;
}

The line in the function is giving me the following error:
Fatal error: Cannot use object of type stdClass as array

When I do a print_r on $tweet I get the following output:

object(stdClass)#70 (19) {
  ["in_reply_to_screen_name"]=>
  NULL
  ["in_reply_to_user_id"]=>
  NULL
  ["in_reply_to_status_id"]=>
  NULL
  ["coordinates"]=>
  NULL
  ["retweeted"]=>
  bool(false)
  ["created_at"]=>
  string(30) "Mon Mar 12 16:54:05 +0000 2012"
  ["id_str"]=>
  string(18) "12345553333"
  ["truncated"]=>
  bool(false)
  ["user"]=>
  object(stdClass)#78 (38) {
    ["id"]=>
    int(522392463)
    ["profile_image_url_https"]=>
    string(73) "https://si0.twimg.com/profile_images/1891637329/turntable_dots_normal.jpg"
    ["contributors_enabled"]=>
    bool(false)
    ["profile_use_background_image"]=>
    bool(true)
    ["lang"]=>
    string(2) "en"
    ["id_str"]=>
    string(9) "522392463"
    ["default_profile_image"]=>
    bool(false)
    ["geo_enabled"]=>
    bool(false)
    ["profile_text_color"]=>
    string(6) "333333"
    ["is_translator"]=>
    bool(false)
    ["favourites_count"]=>
    int(0)
    ["location"]=>
    string(11) "Chicago, IL"
    ["time_zone"]=>
    NULL
    ["utc_offset"]=>
    NULL
    ["show_all_inline_media"]=>
    bool(false)
    ["profile_sidebar_border_color"]=>
    string(6) "C0DEED"
    ["name"]=>
    string(20) "name"
    ["protected"]=>
    bool(false)
    ["profile_background_image_url_https"]=>
    string(49) "https://si0.twimg.com/images/themes/theme1/bg.png"
    ["profile_background_tile"]=>
    bool(false)
    ["following"]=>
    NULL
    ["profile_sidebar_fill_color"]=>
    string(6) "DDEEF6"
    ["follow_request_sent"]=>
    NULL
    ["default_profile"]=>
    bool(true)
    ["statuses_count"]=>
    int(2)
    ["description"]=>
    string(56) "Description"
    ["notifications"]=>
    NULL
    ["verified"]=>
    bool(false)
    ["profile_background_color"]=>
    string(6) "C0DEED"
    ["listed_count"]=>
    int(0)
    ["profile_image_url"]=>
    string(71) "http://a0.twimg.com/profile_images/1891637329/turntable_dots_normal.jpg"
    ["profile_background_image_url"]=>
    string(47) "http://a0.twimg.com/images/themes/theme1/bg.png"
    ["followers_count"]=>
    int(3)
    ["url"]=>
    string(28) "http://www.website.com"
    ["friends_count"]=>
    int(9)
    ["created_at"]=>
    string(30) "Mon Mar 12 16:38:11 +0000 2012"
    ["profile_link_color"]=>
    string(6) "0084B4"
    ["screen_name"]=>
    string(10) "Username"
  }
  ["in_reply_to_status_id_str"]=>
  NULL
  ["geo"]=>
  NULL
  ["retweet_count"]=>
  int(0)
  ["favorited"]=>
  bool(false)
  ["place"]=>
  NULL
  ["source"]=>
  string(3) "web"
  ["in_reply_to_user_id_str"]=>
  NULL
  ["contributors"]=>
  NULL
  ["id"]=>
  float(1.7924891374269E+17)
  ["text"]=>
  string(140) "This is the tweet"
}

How can I access the text without getting the error?

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-31T05:28:57+00:00Added an answer on May 31, 2026 at 5:28 am

    The error means exactly what it is, $tweet is not an array, thus it makes no sense trying to get its 0th index.

    $tweet->text should just be fine 🙂

    If you make sure $tweet is an array of tweet informations:

    foreach($tweet as $t) {
       echo $t->text;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
All I want is to update an ListViewItem's text whithout seeing any flickering. This
All, See the code below: function menu() { this.menuitem=[]; this.submenu=[]; this.menuitem[0] = $('div#sivname1'); this.menuitem[1]
All, Say I have the following bit of code: select: function(start, end, allDay) {
All, I'm using wordpress with this and for some reason the eventDrop stopped working.
All of a sudden my form link looks like this: <form action=/r.ashx/Models.Module_ContactUs?action=Submit&amp;controller=Contact id=contactUsForm method=post>
All, Say I have the following divs: <div id=rotate_container> <div class=reviews id=item1>This is item
All too often I want a WPF slider that behaves like the System.Windows.Forms.TrackBar of
All, I am building a small site using PHP. In the site, I receive
All, I am trying to create a table to receive user inputs (UGC). This

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.