What are common issues when displaying text from a text file in a textarea in PHP?
One common issue when displaying text from a text file in a textarea in PHP is that the text may not be formatted correctly, especially if it contains special characters or line breaks. To solve this issue, you can use the `nl2br()` function in PHP to convert newlines to HTML line breaks before displaying the text in the textarea.
<?php
// Read text from a file
$text = file_get_contents('file.txt');
// Convert newlines to HTML line breaks
$text = nl2br($text);
?>
<textarea><?php echo $text; ?></textarea>