problem with multidimensional array does not take value

2
 $dados= '{"nome":"teste","cpf":"teste"}';
 $value = json_decode($dados, TRUE);

foreach($value as $in)
{
$nome = $in->{'nome'};
$cpf = $in->{'cpf'};
}

I'm trying to get the data, but the value name and cpf comes null !!!

    
asked by anonymous 14.03.2017 / 14:06

1 answer

2

Try this:

$dados= '[{"nome":"teste","cpf":"teste"}]';
$value= json_decode($dados, TRUE);
foreach($vaue as $in)
{
  $nome = $in['nome'];
  $cpf $in['cpf']; 
}
    
14.03.2017 / 14:07