When do I use the PHP constant “PHP_EOL”?

前端 未结 19 2331
攒了一身酷
攒了一身酷 2020-11-22 06:21

When is it a good idea to use PHP_EOL?

I sometimes see this in code samples of PHP. Does this handle DOS/Mac/Unix endline issues?

19条回答
  •  灰色年华
    2020-11-22 07:21

    When jumi (joomla plugin for PHP) compiles your code for some reason it removes all backslashes from your code. Such that something like $csv_output .= "\n"; becomes $csv_output .= "n";

    Very annoying bug!

    Use PHP_EOL instead to get the result you were after.

提交回复
热议问题