0
How do I add line break in php?
Is it the same as html </br>
4 ответов
+ 2
To add line break to regular HTML output use <br />, or <br> no difference
To add line break to HTML with preformatted style (<pre> </pre>) use \n
Both must be inside a string to print.
P.S. Put PHP on your thread tags.
+ 1
Thanks Ipang.
My point is this:
<?php
echo "A";
echo "B";
echo "C";
?> The output will be ABC✔️
Now supposed I want the output to be
A
B
C
How do I do it in php?
Thank you once again
+ 1
Here's a little example 👇
<?php
$a = 'Hello';
$b = 'world';
$c = 'peace';
echo '<p>Using \n</p>';
echo "$a\n$b\n$c";
echo '<p>Using <br> or <br /></p>';
echo "$a<br />$b<br />$c";
echo '<p>Using \n in a <pre> </pre></p>';
echo '<pre>';
echo "$a\n$b\n$c";
echo '</pre>';
?>
+ 1
Many thanks Ipang. Truly appreciate that 🙏💯🙏