Hello,
In very many open source scripts and books is a code similar to this one that determines the creation of a new line compatible for all operating systems.
<?php
function newLine() {
if (strtoupper(substr(PHP_OS,0,3)=='WIN')) {
$eol = "\\r\
";
} elseif (strtoupper(substr(PHP_OS,0,3)=='MAC')) {
$eol="\\r";
} else {
$eol="\
";
}
return $eol;
}
echo "my texte" . newLine();
but I do not understand why people do this if PHP offers a constant for this “PHP_EOL”
There he thus a reason for that?