You’ll want to read the var dump types to determine how to access the data structure. If it says object
(e.g., in your dump it first lists object(stdClass)#13
), then you’ll use ->
operator to access the listed elements (e.g., $object->contact
). If it says array
, you can use index notation [0]
or, if more than one element, iterate with a loop construct:
foreach ($object->contact as $contact) {
foreach ($contact->fields as $field) {
if ($field->type == 'name') {
echo $field->value->givenName, ' ', echo $field->value->middleName;
}
}
}
solved Read var_dump data with PHP