Click here to Skip to main content
15,944,136 members
Please Sign up or sign in to vote.
2.00/5 (1 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.
Sergey Alexandrovich Kryukov 18-Jan-13 2:16am    
Echo... where? in what content type? :-)

1 solution

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…

Share this answer

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900