Join the Stack Overflow Community
Stack Overflow is a community of 6.8 million programmers, just like you, helping each other.
Join them; it only takes a minute:
Sign up

I am trying to print values in this nested stdClass Object but I'm having trouble accessing them. How do I print the ID?

stdClass Object (
    [AddUserWithLimitResult] => stdClass Object (
        [Header] => stdClass Object ( 
            [Code] => UserAdded
            [Description] => User created
        )
        [ID] => 2243272
        [UserName] => gmail.com
        [FirstName] => sar 
        [LastName] => Sea
        [Email] => gmail.com 
        [SubDomain] => olo
    )
) 

I tried this:

$object->AddUserWithLimitResult->Header->Code->ID;
share|improve this question
    
Have you tried something ? – Rizier123 Mar 19 '15 at 20:28
    
yes, i tried this: $object->AddUserWithLimitResult->Header->Code->ID; – user995691 Mar 19 '15 at 20:30
    
^ Add this to your question! – Rizier123 Mar 19 '15 at 20:30
up vote 3 down vote accepted

If you tab out the output it becomes clear that ID is a property of AddUserWithLimitResult

stdClass Object ( 
    [AddUserWithLimitResult] => stdClass Object (
        [Header] => stdClass Object (
            [Code] => UserAdded 
            [Description] => User created 
        )
        [ID] => 2243272 
        [UserName] => gmail.com
        [FirstName] => sar 
        [LastName] => Sea 
        [Email] => gmail.com 
        [SubDomain] => olo 
    ) 
)

$object->AddUserWithLimitResult->ID

Edit: It looks like you updated the question with the tabbed code. When I saw it it was difficult to tell which properties belonged to which objects.

share|improve this answer
    
thanks! my fault :( – user995691 Mar 19 '15 at 20:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.