php: \n
- Started
- Last post
- 16 Responses
- to
i start learning php today...
what does this "\n" mean, at the end of php-tag?print "<p>Today we have a GREAT deal on a $deal_of_day car:</p>\n";
- drgs0
line break
- Dancer0
end of line
- emecks0
Good morning!!
Well my fine fellow the \n you are enquiring about is a line break.
if you do something along the lines of
print "<p>line one</p> \n <p>line two</p>";
and compare that to this:
print "<p>line one</p> <p>line two</p>";
you will see the difference it makes :)I hope and trust that this will be of use to you old chap!
Gouranga!!
- lol, no difference...to
- it's different if you look at the codeneverblink
- to0
THANK YOU! hard tough times...for me ;)
- drgs0
i was first ... the best
- Spookytim0
I am bringing up the rear to say I have absolutely no idea what it is.
I am last, and totally lacking in knowledge. I am the worst.
- to0
yes...it's a line-break for the sourcecode...
- neverblink0
http://en.wikipedia.org/wiki/New… (also deals with \r\n - which you will need if you want to send Headers with php)
- ********0
use echo instead of print
- YAYPaul0
It really depends on what you are outputting, print has function attributes echo does not.
- YAYPaul0
also remember \r!
- drgs0
yes, windows style "\r\n"
of course the line break will only show in code
u probably have more use for "<br>"- As drgs has said, \r\n is really only good for keeping your code readable.YAYPaul
- Rendered code i mean.YAYPaul
- don't you mean <br />. lolsection_014
- to0
yes...now i have understand.
- maximillion_0
function getEOL(){
if (strtoupper(substr(PHP_OS,0,3... {
$eol="\r\n";
} elseif (strtoupper(substr(PHP_OS,0,3... {
$eol="\r";
} else {
$eol="\n";
}
return $eol;
}
- rson0
haha i guess you are going to be posting a lot of PHP HELP threads.
- maximillion_0
in yr example you dont really need it, all it is doing is making sure that the next bit of code that is output to the browser by PHP is on another line.