Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

how do i write a new line in php?

Posted on 2008-06-09
5
Medium Priority
?
621 Views
Last Modified: 2012-06-22
echo $subject.\n.$op1;
why this is not working and how do i i write a new line?
0
Comment
Question by:mgtm3
5 Comments
 
LVL 4

Expert Comment

by:intrwrks
ID: 21745361
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
 
LVL 48

Expert Comment

by:hernst42
ID: 21745362
echo $subject."\n".$op1;
the newline char must be enclosed in double quotes
0
 
LVL 24

Accepted Solution

by:
glcummins earned 2000 total points
ID: 21745364
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
 
LVL 17

Expert Comment

by:psimation
ID: 21745366
$subject."\n".$op1; or $subject."\n\r".$op1;
0
 

Author Closing Comment

by:mgtm3
ID: 31465497
this is the only one that worked
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
This article discusses how to create an extensible mechanism for linked drop downs.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

773 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question