PHP_EOL newline character in php_PHP tutorial

WBOY
Release: 2016-07-14 10:11:59
Original
730 people have browsed it

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.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/477285.htmlTechArticleWhen I was reading the manual, I found the variable PHP_EOL. After checking the information, it turned out that it is equivalent to the newline character n in the unix series. Use rn in the windows series and r in mac. You can use PHP_EOL instead in PHP to provide...
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!