470,874 Members | 1,554 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,874 developers. It's quick & easy.

should newline contain a crlf?

If I want to write client independant code, and generate
new lines for WINDOWS as well as UNIX, how can I tell
from a php scrip what to use?

Should it be '\n' or '\r\n' or '\r' ?

The unix people don't like the \r's, but if I leave them out,
the Windows people can't read the generated file.

Jul 17 '05 #1
1 2169
"PagCal" wrote:
If I want to write client independant code, and generate
new lines for WINDOWS as well as UNIX, how can I tell
from a php scrip what to use?

Should it be í\ní or í\r\ní or
í\rí ?

The unix people donít like the \rís, but if I leave them
out,
the Windows people canít read the generated file.


If you are asking about detecting Windows vs. Unix, use this code:

$bWindows = strpos($_ENV[íOSí], "Win") !== false;

so $bWindows will be true if on Windows machine.

--
http://www.dbForumz.com/ This article was posted by author's request
Articles individually checked for conformance to usenet standards
Topic URL: http://www.dbForumz.com/PHP-newline-...ict135955.html
Visit Topic URL to contact author (reg. req'd). Report abuse: http://www.dbForumz.com/eform.php?p=454418
Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by Leeds, Mark | last post: by
5 posts views Thread by McKirahan | last post: by
6 posts views Thread by The Plankmeister | last post: by
3 posts views Thread by JJ | last post: by
reply views Thread by Quan Nguyen | last post: by
29 posts views Thread by runningdog | last post: by
8 posts views Thread by Jm | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.