Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: "J.O. Aho" Newsgroups: comp.lang.php Subject: Re: echo "
" wouldn't print a new line Date: Sun, 31 Jul 2016 08:17:59 +0200 Lines: 45 Message-ID: References: <83e11700-3227-43a8-bf36-ab77004976e6@googlegroups.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-Trace: individual.net W1W6W9CFE3YAHiDcb34ceQLD+EJJ36CneutMFErKTO2XO9yH2u Cancel-Lock: sha1:4GMupMtwU8D1gmBT5Q1HQ/4+xjk= X-Enigmail-Draft-Status: N1110 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.8.0 In-Reply-To: Xref: csiph.com comp.lang.php:16896 On 07/24/16 18:14, Sebastiaan Kop wrote: > Arno Welzel wrote: >> Alla, 2016-07-04 12:06: >> >>> Hello! >>> >>> I am currently learning C programming, and still a newby, but I have also started php. >>> I will be grateful for your help. >>> >>> I have watched a tutorial for beginners on using some functions, and the author >>> used echo "
"; command to print a new line for the next output. I have tried it, >>> but it didn't work. What could be the problem? >> >> The problem is that "
" is not a "new line", it is just the HTML >> element for line break. Since PHP is often used to create HTML output >> the tutorial may just refer to HTML and not console output. >> >> So if you want to output content as *HTML* then "
" is fine to have a >> line break, but if you want to output plain text to a console or >> text/plain to a browser, you need "\n" as in C as well. >> >> > > I always use: > > Echo "
\r\n"; > > This makes a new line in the html source also. That can cause some trash characters at the end of the line, as "new line" is quite operating system dependant. Sure you can use PHP_EOL and you will always get the right "new line" for the server, but may not be true for the client. The argument I have against the microsoft-windows "new line" is that it uses twice as many bytes as the Unix one and more applications will handle it correctly too. In the end it's the purpose of the "new line" which dictates what you should use. -- //Aho