不在php中输出换行符

$whichwrong = "The following questions were not answered correctly: 

";
$whichwrong .= "Question Number: $questionNum || Your Answer: $userAnswers[$s][$q]
";
echo $whichwrong;

Displays:

The following questions were not answered correctly: Question Number: 2 || Your Answer: b Question Number: 4 || Your Answer: c Question Number: 5 || Your Answer: a Question Number: 1 || Your Answer: b Question Number: 3 || Your Answer: b Question Number: 1 || Your Answer: b Question Number: 2 || Your Answer: a Question Number: 1 || Your Answer: b Question Number: 2 || Your Answer: b

Why is the " " not working correctly?

Meanwhile this works just fine:

$totalValue .= "Correct: {$correct}
";
$totalValue .= "Wrong: {$wrong}
";

Use nl2br for inserting html-linebreaks (<br />)

echo nl2br($whichwrong);

Normal are treated by browsers like normal whitespaces.

If you're viewing it in a browser, you need to use <br> - you can also use the nl2br() function. If you're in the console, try