Solved

how do i write a new line in php?

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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.

760 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now