What potential pitfalls should be considered when outputting multi-line text in PHP within a table?

When outputting multi-line text in PHP within a table, one potential pitfall to consider is that HTML does not interpret line breaks or new lines within text by default. To ensure that multi-line text is displayed correctly within a table cell, you can use the nl2br() function in PHP to convert new lines to HTML line breaks <br>. This will preserve the line breaks in the text and display it properly within the table cell.

&lt;?php
$text = &quot;This is a multi-line
text example.&quot;;
?&gt;

&lt;table&gt;
  &lt;tr&gt;
    &lt;td&gt;&lt;?php echo nl2br($text); ?&gt;&lt;/td&gt;
  &lt;/tr&gt;
&lt;/table&gt;