0

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;
3
  • Have you tried something ? Commented Mar 19, 2015 at 20:28
  • yes, i tried this: $object->AddUserWithLimitResult->Header->Code->ID; Commented Mar 19, 2015 at 20:30
  • ^ Add this to your question! Commented Mar 19, 2015 at 20:30

1 Answer 1

3

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.