Tuesday, July 28, 2009

How do you create a line break in php?

I am formatting a header and want to create a line break between divisions. in html i would write:


%26lt;div%26gt; XYZ %26lt;/div%26gt;


%26lt;br%26gt;


%26lt;div%26gt; ABC%26lt;/div%26gt;


but is there a php equivalent to %26lt;br%26gt;





Thanks!

How do you create a line break in php?
I see what you're saying:





%26lt;?php





echo "





%26lt;div%26gt;XYZ%26lt;/div%26gt;






%26lt;div%26gt;ABC%26lt;/div%26gt;





";





?%26gt;





Now, what the "\n" does is make a break in the actual code outputted, but not a break in the content.


Make sense?
Reply:Yep - it is \n.
Reply:\n
Reply:\n is a line break. make sure you're echoing/printing \n in double quotes though, else it will be rendered literally as \n.





so "\n" not '\n'





for other control characters check here:


http://www.php.net/manual/en/language.ty...
Reply:or you can just echo the break
Reply:%26lt;?php


echo "\n";


?%26gt;


No comments:

Post a Comment