Solved

how do i write a new line in php?

Posted on 2008-06-09
5
615 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 500 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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

776 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