1
I created an array that has the following structure:
$arr = array(
"cabecalho" => [
"instrucoes" => array("Instrucao 1", "Instrucao 2", "Instrucao 3", "Instrucao N"),
"dadosAluno" => array("codigoAluno" => "123456789", "nomeCompleto" => "John Doe"),
"dadosProva" => array(
"curso" => "Administracao",
"disciplina" => array("tipo" => "Modulo", "nome" => "Etica"),
"periodoRealizacao" => array("inicio" => "2020-07-01", "fim" => "2020-07-31"),
"periodoRealizacao2" => array("inicio" => "2020-07-01", "fim" => "2020-07-31"),
"tempoDeProvaEmSegundos" => "3600"
),
"UrlLogin" => "https://wwwexemplo.com/login/",
"UrlRetorno" => "https://wwwexemplo.com/retorno/"
],
"questoes" => [[
"idExterno" => "1",
"pergunta" => "Pergunta 1",
"respostasPossiveis" => array(
array("opcao" => "A", "texto" => utf8_encode("Resposta A da pergunta 1")),
array("opcao" => "A", "texto" => utf8_encode("Resposta A da pergunta 1")),
),
"idExterno" => "2",
"pergunta" => "Pergunta 2",
"respostasPossiveis" => array(
array("opcao" => "A", "texto" => utf8_encode("Resposta A da pergunta 2")),
array("opcao" => "A", "texto" => utf8_encode("Resposta A da pergunta 2")),
),
]],
);
When executing the command: echo '<pre><br />';print_r($arr['questoes']);echo '</pre>';die();
is returning the second structure
(
[0] => Array
(
[idExterno] => 2
[pergunta] => Pergunta 2
[respostasPossiveis] => Array
(
[0] => Array
(
[opcao] => A
[texto] => Resposta A da pergunta 2
)
[1] => Array
(
[opcao] => A
[texto] => Resposta A da pergunta 2
)
)
)
)
It is not displaying the first array that contains the idExterno
equal to 1 and all its contents of question 1 is not displayed.
The last amount is overwriting the first or everyone there is before, how do I fix this?
Thanks, it worked out!
– Consule