How can one ensure that line breaks are properly displayed in PHP strings?

When displaying text in PHP strings that contain line breaks, it is important to use the correct escape characters to ensure that the line breaks are properly displayed. The most common escape character for line breaks in PHP strings is "\n". By including "\n" in the string where line breaks should occur, PHP will interpret it as a line break when the string is displayed.

$text = "This is a string with a line break.\nThis is the second line.";
echo $text;