Hi All,
Newline(\n) is not inserting a new line on the browser. Can some body help me how can I insert a new line on the browser.

I know the html tag<br /> will help. But is there any other way ?

Here is the snippet of the code which i used

<body>       <?php
            echo "\n\n Continue and  For Loop  \n ";

            for($count=0; $count <= 10; $count++)
        if($count == 5)
        echo "value of \$count is ::> $count \n   " ;



Edited by Nick Evan: Fixed formatting

6 Years
Discussion Span
Last Post by broj1

\n is not a html tag. It does insert a new line in the source (view page source and you will see it). To have a new line in html page you need to use either <br /> or wrap each line in <p></p> or <div></div> pair like

echo "<div>value of \$count is ::> $count </div>" ;

You can change the spacing between lines with css.

The other option is to use nl2br() function. See http://php.net/manual/en/function.nl2br.php.

Edited by broj1: n/a

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.