1
colleagues. I have this code:
<gabarito>
<avaliacao tipo="Prova" codigo="01" segmento="Ensino Médio" serie="Pré-Vestibular" questoes="20">
<disciplina nome="Matemática">
<questao numero="1" alternativas="A,B,C,D,E">
<resposta>C</resposta>
</questao>
<questao numero="2" alternativas="A,B,C,D,E">
<resposta>D</resposta>
</questao>
<questao numero="3" alternativas="A,B,C,D,E">
<resposta>A</resposta>
</questao>
</disciplina>
<disciplina nome="Física">
<questao numero="1" alternativas="A,B,C,D,E">
<resposta>C</resposta>
</questao>
<questao numero="2" alternativas="A,B,C,D,E">
<resposta>D</resposta>
</questao>
<questao numero="3" alternativas="A,B,C,D,E">
<resposta>A</resposta>
</questao>
</disciplina>
</avaliacao>
</gabarito>
Only that the students answer the templates by the system and is stored in this way in the bank:
C,D,A,C,A,E,A,B,C,C,B,D,A,C,D,D,B,B,B,A
I would like to compare the answers of the students with that of the feedback, count and separate by each discipline. Ex.:
Mathematics => 2 correct answers; Physics => 4 certain;
It is possible to do this?
My initial code is this:
foreach($xml->avaliacao->disciplina as $disciplina) {
$res = $disciplina->attributes();
if($res["nome"]){
$questoes = count($xml->avaliacao->disciplina->questao);
echo $questoes;
}
}
But I’m not making any progress...
Abfurlan... it worked... I couldn’t have done it without your help...
– user24136