Click here to Skip to main content
13,550,803 members
Rate this:
Please Sign up or sign in to vote.
See more:
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 19:46pm
SAKryukov 18-Jan-13 2:16am
Echo... where? in what content type? :-)

1 solution

Rate this: bad
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:[^].

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…


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

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01-2016 | 2.8.180515.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2018
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