1

I use the API of my CRM to receive contacts. Now, I want to access the email address of the contact:

$result = $api->findContacts($params); print_r($result[0]->email); 

returns ...

stdClass Object ( [0] => [email protected] [--primary] => [email protected] ) 

How can access the email address stored in [--primary] via PHP? I tried $result[0]->email->--primary etc, but does not work.

Thanks

1
  • 2
    Please, don't access those variables directly. Create a function to that returns them. Commented Aug 2, 2012 at 9:09

1 Answer 1

1

Try this :

$primary = '--primary'; echo $result[0]->email->{$primary}; 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.