When I was reading the manual, I found the PHP_EOL variable. After checking the information, it turned out that it is equivalent to the newline character
Use n
in unix series
Use rn
in windows series
Use r
on mac
PHP_EOL can be used instead in PHP to improve the source code portability of the code
For example:
[php]
echo PHP_EOL;
//Windows platform is equivalent to echo "rn";
//unixlinux platform is equivalent to echo "n";
//Mac platform is equivalent to echo "r";
echo PHP_EOL;
//The windows platform is equivalent to echo "rn";
//The unixlinux platform is equivalent to echo "n";
//Mac platform is equivalent to echo "r";
We can use the function get_defined_constants() to get all PHP constants.