What is the default behavior of HTML regarding line breaks and how does it affect PHP output?
By default, HTML collapses multiple consecutive whitespace characters, including line breaks, into a single space. This can affect the output of PHP code that relies on line breaks for formatting, such as displaying text in separate lines or paragraphs. To preserve line breaks in PHP output within HTML, you can use the nl2br() function to convert newline characters to HTML line breaks (<br> tags).
<?php
$text = "This is a multi-line
text with line breaks.";
echo nl2br($text);
?>