co.ador Posted March 7, 2010 Share Posted March 7, 2010 It means a new line, that means that after the "\n" a new line is going to start the parser will go down? it's like a <br/> tag kind right? Quote Link to comment https://forums.phpfreaks.com/topic/194392-what-the-n-means/ Share on other sites More sharing options...
Irap Posted March 7, 2010 Share Posted March 7, 2010 <br /> is a HTML, which will make things you can see in the page start a new line. However if the text isn't formatted (and is a plain text file or the source of the HTML file) \n will start a new line with no characters visible. so: echo "<b>Test</b>\n<i>Hello!</i>" Would print out: Testhello But the source of the file, would print: <b>Test</b> <i>Hello!</i> Wheras: echo "<b>Test</b><br /><i>Hello!</i>" Would print: Test Hello! But the source code would be: <b>Test</b><br /><i>Hello!</i> Quote Link to comment https://forums.phpfreaks.com/topic/194392-what-the-n-means/#findComment-1022550 Share on other sites More sharing options...
co.ador Posted March 7, 2010 Author Share Posted March 7, 2010 So it means a new line in source but no in the browser display. I see a lots of codes using this "\n" but really still battling for the real usage and meaning I understood some of what you said but can't related to a real live usage. Quote Link to comment https://forums.phpfreaks.com/topic/194392-what-the-n-means/#findComment-1022552 Share on other sites More sharing options...
roopurt18 Posted March 7, 2010 Share Posted March 7, 2010 If you want an actual carriage return in the output, you use a "\n". Try writing a PHP console program that has to fit its output in a display 80 characters wide. Quote Link to comment https://forums.phpfreaks.com/topic/194392-what-the-n-means/#findComment-1022575 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.