Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: PHP
I have a problem with \n special character in php.
i am using :
echo "newline demo \n which display next content on new line";
 
but in output it doesn't give new line. so how can i give new line in php script.
Posted 17-Jan-13 20:46pm
Comments
Sergey Alexandrovich Kryukov at 18-Jan-13 2:16am
   
Echo... where? in what content type? :-)
—SA

1 solution

Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

What is "new line" depends on OS and, sometimes, where you use it. For example, in Windows, new line is CR LF (\r\n), but in MessageBox, either of these characters along acts as a new line. In edit controls, it would not work.
 
Please see: http://en.wikipedia.org/wiki/New-line[^].
 
Most usually, PHP is used as a server-side script in Web applications, and, even more typically, it generates HTML HTTP output. But in HTML '\n' is not a new line, it is а… blank character. New line is <br/>. Well, in case you did not know…
 
—SA
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 7,442
1 OriginalGriff 5,996
2 Peter Leow 4,292
3 CHill60 2,858
4 Mika Wendelius 2,850


Advertise | Privacy | Mobile
Web02 | 2.8.150224.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100