0

How do I add line break in php?

Is it the same as html </br>

16th Apr 2020, 10:31 AM
Willard Makinishi
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.
16th Apr 2020, 10:55 AM
Ipang
+ 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
16th Apr 2020, 11:02 AM
Willard Makinishi
+ 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 &lt;br&gt; or &lt;br /&gt;</p>'; echo "$a<br />$b<br />$c"; echo '<p>Using \n in a &lt;pre&gt; &lt;/pre&gt;</p>'; echo '<pre>'; echo "$a\n$b\n$c"; echo '</pre>'; ?>
16th Apr 2020, 11:27 AM
Ipang
+ 1
Many thanks Ipang. Truly appreciate that 🙏💯🙏
16th Apr 2020, 11:35 AM
Willard Makinishi