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 students respond to the templates through the system and are stored in the database:
A, C, A, A, A, B, C, B, D, A, C, D, B, B, B, A
I would like to compare the students' answers with the feedback, to count and to separate by each discipline. Ex.:
Mathematics = > 2 hits; Physics = > 4 right;
Is it 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 can not make progress ...