Jump to content

PHP Line Break


Nathan
 Share

Recommended Posts

  • Administrators

So I'm very new to PHP and trying to learn a few thing.

 

I'm trying to keep all my code standard. What's the correct way to do a line break in PHP? Such as </br> in HTML?

 

This is how I'm currently doing it:

 

<?php
echo $data[0]->like_count;
print "<p>Thank you for your purchase!</p>";
?>

Link to comment
Share on other sites

If you are using double quotes (") around your body content, you can use n for a line break. However, if you are using single quotes (') around your body, you can simply enter a line.

 

Example (")

$body = "Line OnenLine Two";

This would come out as:

Line One

Line Two

 

Example (')

$body = 'Line One

Line Two';

This would also come out as:

Line One

Line Two

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...