Home>Article>Backend Development> PHP PHP_EOL newline character

PHP PHP_EOL newline character

步履不停
步履不停 Original
2019-06-26 17:12:49 3415browse

PHP PHP_EOL newline character

Line break
Unix series uses\n
windows series uses\r\n
mac uses\r
You can use PHP_EOL in PHP instead. To improve the source code level portability of the code

For example:


Similarly commonly used ones are
DIRECTORY_SEPARATOR

can Use the function get_defined_constants() to get all PHP constants

Usage: Define constant EOL

define ('EOL',(PHP_SAPI == 'cli' ) ? PHP_EOL : 'df250b2156c434f3390392d09b1c9563');

php_sapi_name — Returns the interface type between the web server and PHP

Description

stringphp_sapi_name( void )

Returns a lowercase string describing the interface type used by PHP (the Server API, SAPI). For example, under the CLI of PHP this string would be "cli", and under Apache there may be several different values, depending on the specific SAPI used. Possible values are listed below.

Recommended related PHP video tutorials:《PHP Video Tutorial》

The above is the detailed content of PHP PHP_EOL newline character. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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
Previous article:php life cycle Next article:php life cycle