0
I have a question regarding an array. I have the following information:

What I’m not getting is to go through the other array. Below is the code.
 foreach ($file_contents->retorno->contatos as $contatos) {
echo "{$contatos->contato->codigo} - {$contatos->contato->nome} - ";
foreach ($contatos->contato->tiposContato as $contato) {
    dd($contato->tipoContato->descricao);
}
echo '<br>';
 }
When I put the dd it works.
When printing with echo he of error.
foreach ($file_contents->retorno->contatos as $contatos) {
echo "{$contatos->contato->codigo} - {$contatos->contato->nome} - ";
foreach ($contatos->contato->tiposContato as $contato) {
    echo $contato->tipoContato->descricao;
}
echo '<br>';
}


Add
if(!isset($contatos->contato->tiposContato)){ dd($contatos->contato); }in the first line of its secondforeachto verify which data is in the error– Erlon Charles
@Erloncharles, I added the if inside the second foreach, but it keeps giving the following error Undefined Property: stdClass::$tipsContact
– shadow
put before the foreach
– Erlon Charles