Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

how do i write a new line in php?

Posted on 2008-06-09
5
Medium Priority
?
620 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

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

Build an array called $myWeek which will hold the array elements Today, Yesterday and then builds up the rest of the week by the name of the day going back 1 week.   (CODE) (CODE) Then you just need to pass your date to the function. If i…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
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…

718 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