0
I have the following Json in a PHP variable:
[
{"pergunta[0]":"Quantos anos?"},
{"pergunta[1]":"Qual sua altura?"},
{"resposta[0]":"12"},
{"resposta[1]":"1.65"}
]
and my goal is to show it as follows:
How old? 12.
How tall are you? 1.65.
I tried that way:
$obj = json_decode([{"pergunta[0]":"Quantos anos?"},{"pergunta[1]":"Qual sua altura?"},{"resposta[0]":"12"},{"resposta[1]":"1.65"}]);
echo $obj['pergunta'];
Any suggestions?
Have you tried printar
$obj
withvar_dump()
orvar_export
to understand what structure he has? Look at that– fernandosavio