How can HTML output be manipulated to handle line breaks differently than the data stored in a database in PHP?
When outputting data from a database in PHP to HTML, line breaks stored in the database may not be displayed correctly. To handle line breaks differently, you can use the PHP nl2br() function to convert newline characters to <br> tags before displaying the data in HTML.
<?php
// Retrieve data from the database
$data = "This is a text with\nline breaks.";
// Output the data with line breaks converted to <br> tags
echo nl2br($data);
?>