When do I use the PHP constant “PHP_EOL”?

前端 未结 19 2228
攒了一身酷
攒了一身酷 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:02

    I prefer to use \n\r. Also I am on a windows system and \n works just fine in my experience.

    Since PHP_EOL does not work with regular expressions, and these are the most useful way of dealing with text, then I really never used it or needed to.

提交回复
热议问题