Home>Article>Backend Development> 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!