Guest User

Untitled

a guest
Sep 11th, 2019
86
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.   $correctAnswers = 0;
  2.         $answer;
  3.         $correctAnswer;
  4.  
  5.         for ($x = 1; $x <= $loopLength; $x++) {
  6.             $answer = $request->request->get('answer-' . $x);
  7.             $correctAnswer = ($quiz[$x-1]->getAnswer()) ? 'true' : 'false';
  8.             if( $answer === $correctAnswer ){
  9.                 $correctAnswers++;
  10.             }
  11.         }
  12.  
  13.         $percentageOfCorrectAnswers = ($correctAnswers * 100)/$loopLength;
RAW Paste Data