SHARE
TWEET

Untitled

a guest Sep 11th, 2019 85 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
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top