Skip to content

Instantly share code, notes, and snippets.

@tperrelli
Created April 26, 2018 20:28
Show Gist options
  • Save tperrelli/c608e3453e5fad07026da9213b38a253 to your computer and use it in GitHub Desktop.
Save tperrelli/c608e3453e5fad07026da9213b38a253 to your computer and use it in GitHub Desktop.
Raffaele.php
<?php
$dados = [
'lote_id' => 1,
'beneficiario' => [
'nome' => 'joão',
'idade' => 45
]
];
foreach ($dados as $chave => $valor) {
if (is_array($valor)) {
foreach ($valor[$chave] as $chave2 => $valor2) {
echo $valor2;
// joão
// 45
}
} else {
echo $echo;
// saida 1
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment