You could do this with an array a couple different ways.
You could add the value of "1" to an array for each correct answer and the either just "count" the length of the array.
$score = count ($array);
So each time you add to the array you increase the lenght of the array.
Or you could add "1", "2" or say "5" to the array and award higher values for correct answers and then at the end "Sum" the arrary.
$score = sum($array);
Good Luck