Hi ppl,

I am facing this weird problem with php newline character.

echo"Hello World!! \n Im new to php";

can anyone pls point out what is wrong in the above code??
the output should be:
Hello World!!
Im new to php
but the output goes on the same line:
Hello World!! Im new to php

where am i going wrong pls point..


Recommended Answers

All 4 Replies

Try to use <br>


echo "Hello World!!"."<br>"."Im new to php";//sample 1

echo "Hello World!! <br> Im new to php";//sample 2

thanks a ton lyrico...u saved my day :)
have a nice day..

well im curious to know, why this happens? can anyone pls explain?? why cant we use "\n" in php. In fact i was using it like that until now, all of a sudden, it would not work for me today.


Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.