Appearance
Converting <br> into a new line for use in a text area โ
In PHP, you can use the nl2br() function to convert line breaks (\n or \r\n) to <br /> tags. To convert <br /> tags back to line breaks in a text area, you can use the str_replace() function.
Here is an example:
Example of converting
into a new line to use in a text area in PHP
php
<โ?php
$text = "Line 1<br />Line 2<br />Line 3";
$text = str_replace("<br />", "\n", $text);
echo $text;
<div class="alert alert-info flex not-prose">Watch a video course Learn object oriented PHP
</div>
This will replace all instances of <br /> with a new line character, so that the text can be displayed correctly in a text area.