newline characters in PHP error log or debug output

There is a PHP Predefined constant PHP_EOL that allows you to print a newline character if you are running php CLI or if you are outputting text to an error log file.

Apparently, it is also cross platform compatible.

For a long time I was using print statements to throw debug output and had a hard time reading the blob of text output that was getting spit out.

Now my log output and debug output are much more readable :-)

Leave a Reply