Home>Article>Backend Development> PHP_EOL newline parsing in php
When I read the manual, I found the variable PHP_EOL. After checking the information, it turned out that it is equivalent to the newline character. In PHP, PHP_EOL can be used instead to improve the source code level portability of the code.
Use in unix series\n
Use in windows series\r\n
Use in mac\r
PHP_EOL can be used instead in PHP to improve the source code level portability of the code
For example:
##Copy codeThe code is as follows:
echo PHP_EOL; //windows平台相当于 echo "\r\n"; //unix\linux平台相当于 echo "\n"; //mac平台相当于 echo "\r";We can use the function get_defined_constants() to get all PHP constants.
The above is the detailed content of PHP_EOL newline parsing in php. For more information, please follow other related articles on the PHP Chinese website!