-2

Possible Duplicate:
PHP Echo Line Breaks

There is a \n for Windows and a PHP_EOL for UNIX (I think), but is there a break which works on every platform in a webapp? Or is the PHP_EOL-snippet the one I'm looking for?

Community
  • 1
  • 1
Michiel
  • 7,855
  • 16
  • 61
  • 113
  • The correct 'End Of Line' symbol for this platform, is platform dependent value. – ajreal Nov 25 '11 at 14:17
  • 2
    PHP_EOL doesn't "work on all platforms". it's simply the host platform's EOL character. If you generate a file on a Unix box using PHP_EOL, it won't magically start working on a Windows box, because on Unix, PHP_EOL is `\n`, and on Windows it's `\r\n`. It's simply a handle constant for you to use, so you don't have to figure out your host OS yourself. – Marc B Nov 25 '11 at 14:27

3 Answers3

4

yes, PHP_EOL is what you are looking for

Codler
  • 10,951
  • 6
  • 52
  • 65
2

well, platforms has very little to do here.

The difference is only applicable to the text files, browsed in some outside program.

While for the output the rules may be different from these platform-related ones.
Say, for MIME and HTML "\r\n" is a standard despite of the platform

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
1

PHP_EOL is platform-dependent, and will vary based on what OS PHP is running on.

FtDRbwLXw6
  • 27,774
  • 13
  • 70
  • 107