The PHP_EOL newline character in php is parsed in detail

  • 2020-10-31 21:39:54
  • OfStack

Use \n in the unix series
Use \r\n in the windows series
In mac \ r
PHP can be replaced with PHP_EOL to improve source-level portability of the code

Such as:


    echo PHP_EOL;
       //windows Platform equivalent to     echo "\r\n";
       //unix\linux Platform equivalent to     echo "\n";
       //mac Platform equivalent to     echo "\r";

We can get all PHP constants with the function get_defined_constants().


Related articles: