I have a php parser that split a given string by line-breaks, doing something like this:
$lines = explode(PHP_EOL,$content);
The parser works fine when working on server side. However, when I pass the content via post by ajax (using jquery's $.post method) the problem arises: line breaks are not recogniezed. So after almost an hour of tests and head-aches I decided to changed PHP_EOL by "
" and it worked:
$lines = explode("
",$content);
Now it works! Damn it I lost so much time! Could somebody explain me when use PHP_EOL and "
" properly, so I can save time in the future? Appreciate your kind answers ;)
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…