There are several ways to make your source code readable.
echo "Hello World\n"; //or echo "Hello World\r"; //or echo "Hello World\r\n";
But I don’t like the double quote’s in this notation because when I’m echo html tags into it, I’ll have to escape allt he double quotes. This is why I prefer the following usage.
echo 'Hello World!'.PHP_EOL;
EOL stands for End of Line.
Sometimes the server is running on windows and the EOL tag is this define tag by default. This is the point where a simple hack comes in…
Just put the following line on top of your script:
if(!defined('PHP_EOL')){
define('PHP_EOL', strtoupper(substr(PHP_OS,0,3) == 'WIN') ? "\r\n" : "\n");
}




