2

I'm new to PHP and am trying to access the value of "contactId" from the following:

object(stdClass)#2 (4) { ["contacts"]=> array(1) { [0]=> object(stdClass)#3 (18) { ["email"]=> string(24) "[email protected]" ["firstName"]=> string(3) "Joe" ["lastName"]=> string(8) "Williams" ["prefix"]=> string(3) "Mr." ["suffix"]=> string(3) "Jr." ["fax"]=> string(0) "" ["phone"]=> string(10) "8668039462" ["street"]=> string(21) "2365 Meridian Parkway" ["street2"]=> string(0) "" ["city"]=> string(6) "Durham" ["state"]=> string(2) "NC" ["postalCode"]=> string(5) "27713" ["createDate"]=> string(19) "2013-03-30 21:22:28" ["status"]=> string(6) "normal" ["bounceCount"]=> NULL ["contactId"]=> string(8) "67295434" } } ["limit"]=> int(20) ["offset"]=> int(0) ["total"]=> int(1) } 

How can I retrieve the value of contactId?

Many thanks!

1 Answer 1

3

These are not arrays, but an object containing an array containing an object. PHP object access syntax is with ->

$variableName->contacts[0]->contactId 
Sign up to request clarification or add additional context in comments.

1 Comment

Got it - NOW I see what's going on... duh. Thanks for your fast help. Awesome.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.