• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 625
  • Last Modified:

how do i write a new line in php?

echo $subject.\n.$op1;
why this is not working and how do i i write a new line?
0
mgtm3
Asked:
mgtm3
1 Solution
 
intrwrksCommented:
In order for this to display in a browser, you will need to include the actual HTML to perform a line break.

echo $subject . "<br />" . $op1;

Jason
0
 
hernst42Commented:
echo $subject."\n".$op1;
the newline char must be enclosed in double quotes
0
 
glcumminsCommented:
PHP is designed to generate HTML, so if you are viewing your results in a browser, use the HTML newline: br


 echo $subject."<br />".$op1;

Open in new window

0
 
psimationCommented:
$subject."\n".$op1; or $subject."\n\r".$op1;
0
 
mgtm3Author Commented:
this is the only one that worked
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now