PHP_EOL newline parsing in php

不言
Release: 2023-03-23 10:34:01
Original
2236 people have browsed it

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 code The code is as follows:

 echo PHP_EOL;
       //windows平台相当于    echo "\r\n";
       //unix\linux平台相当于    echo "\n";
       //mac平台相当于    echo "\r";
Copy after login

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!

Related labels:
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!