When do I use PHP_EOL instead of \n and vice-versa ? Ajax/Jquery client problem

后端 未结 5 674
渐次进展
渐次进展 2020-12-01 08:26

I have a php parser that split a given string by line-breaks, doing something like this:

$lines = explode(PHP_EOL,$content);

The parser wor

5条回答
  •  离开以前
    2020-12-01 08:32

    IMHO using PHP_EOL is preferable

    to ensure consistency between PHP and JS handling of line break, you may want to define end-of-line variable in JS using PHP_EOL

    var eol = '';
    

    afterwards, use eol for splitting submitted textarea content

提交回复
热议问题