Home php PHP_EOL





Hi. Updated that this constant provides a row translation for different OS.
Why then in the example

& lt;? php echo 'too'.php_eol.'too'.php_eol.'too'? & gt;

Only gaps appear instead of translations of the strings?
What area of ​​its use?
Only add Header ("Content-Type: Text / Plain"); helps.

Answer 1, Authority 100%

Apparently you look through the browser. In the page code, look there will be a row translation. And for the browser it is necessary to install

Answer 2, Authority 100%

It’s better clear:

& lt;? php
 Echo 'Too'. 'Too'. 'Too'. "& lt; / br & gt;";
 Echo 'Too'.Php_eol.'too'.php_eol.'too';
 Echo "& lt; pre & gt;". 'Too'.php_eol.'too'.php_eol.'too'. "& lt; / pre & gt;";
 ? & gt;

Answer 3, Authority 100%

php_eol can contain only two values ​​or \ r \ n for Windows platforms or \ n for the rest. Previously – up to version 5.4 was the third possible \ R for Mac OSX, but in versions on older it is no longer relevant.

Answer 4

You can use NL2BR ()

& lt;? php echo nl2br ('TOO'.PHP_EOL.'TOO'.PHP_EOL.'TOO');

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions