www.webdeveloper.com
Results 1 to 5 of 5

Thread: How to Get Value from stdClass Object

Threaded View

  1. #1
    Join Date
    Oct 2013
    Posts
    11

    How to Get Value from stdClass Object

    How to get value from class
    Code:
    stdClass Object
    (
        [user] => stdClass Object
            (
                [name] => website
                [likes] => 0
                [following] => 1
                [default_post_format] => html
                [blogs] => Array
                    (
                        [0] => stdClass Object
                            (
                                [name] => alexa
                                [url] => http://alexa.com/
                                [followers] => 0
                                [primary] => 1
                                [title] => Untitled
                                [description] => 
                                [admin] => 1
                                [updated] => 0
                                [posts] => 0
                                [messages] => 0
                                [queue] => 0
                                [drafts] => 0
                                [share_likes] => 1
                                [ask] => 
                                [tweet] => N
                                [facebook] => N
                                [facebook_opengraph_enabled] => N
                                [type] => public
                            )
    
                        [1] => stdClass Object
                            (
                                [name] => google
                                [url] => http://google.com/
                                [followers] => 0
                                [primary] => 
                                [title] => google
                                [description] => 
                                [admin] => 1
                                [updated] => 0
                                [posts] => 0
                                [messages] => 0
                                [queue] => 0
                                [drafts] => 0
                                [share_likes] => 
                                [ask] => 
                                [tweet] => N
                                [facebook] => N
                                [facebook_opengraph_enabled] => N
                                [type] => public
                            )
    
                        [2] => stdClass Object
                            (
                                [name] => yahoo
                                [url] => http://yahoo.com/
                                [followers] => 0
                                [primary] => 
                                [title] => yahoo
                                [description] => 
                                [admin] => 1
                                [updated] => 0
                                [posts] => 0
                                [messages] => 0
                                [queue] => 0
                                [drafts] => 0
                                [share_likes] => 
                                [ask] => 
                                [tweet] => N
                                [facebook] => N
                                [facebook_opengraph_enabled] => N
                                [type] => public
                            )
    
                    )
    
            )
    
    )
    I trying to use this code, but found error,
    the problem on numbering [0] [1] [2]

    I want to get [name] =>???

    PHP Code:
    $userid=$me->user->blogs;    
        for(
    $i 0$i count($userid); $i++){
             echo 
    $me->user->blogs->$i->name."<br />";
        } 
    Please advice.

    Thnk
    Last edited by NogDog; 10-29-2013 at 11:04 AM. Reason: added [code] and [php] tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles