How to OS new line char

How to OS new line char

am 28.08.2007 09:07:50 von Zanna

Hi,

Each OS has its new line chars:

unix = \n
mac = \r
windows = \r\n

Can I get the used one on the OS where php is running?

I see that exists a DIRECTORY_SEPARATOR for the OS path ("/" or "\"), does
not exists something like a "LINE_SEPARATOR"? :)

Thanks

Re: How to OS new line char

am 28.08.2007 09:32:12 von Nodashi

You can use PHP_EOL

On 28 ao=FBt, 09:07, "Fabio" wrote:
> Hi,
>
> Each OS has its new line chars:
>
> unix =3D \n
> mac =3D \r
> windows =3D \r\n
>
> Can I get the used one on the OS where php is running?
>
> I see that exists a DIRECTORY_SEPARATOR for the OS path ("/" or "\"), does
> not exists something like a "LINE_SEPARATOR"? :)
>
> Thanks

Re: How to OS new line char

am 28.08.2007 10:03:13 von gosha bine

On 28.08.2007 09:07 Fabio wrote:
> Hi,
>
> Each OS has its new line chars:

well, this is not completely true. Rather, every program, especially
browser, can have its own new line conventions.

>
> unix = \n
> mac = \r

this is not correct either. New versions of macOS use "\n", like other
unix-based systems.

> windows = \r\n
>
> Can I get the used one on the OS where php is running?

Why do you think you need this?

>
> I see that exists a DIRECTORY_SEPARATOR for the OS path ("/" or "\"), does
> not exists something like a "LINE_SEPARATOR"? :)
>
> Thanks
>
>


--
gosha bine

makrell ~ http://www.tagarga.com/blok/makrell
php done right ;) http://code.google.com/p/pihipi

Re: How to OS new line char

am 28.08.2007 10:21:29 von Willem Bogaerts

> I see that exists a DIRECTORY_SEPARATOR for the OS path ("/" or "\"), does
> not exists something like a "LINE_SEPARATOR"? :)

From the documentation:
PHP_EOL (string)
Available since PHP 4.3.10 and PHP 5.0.2

Best regards,
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/

Re: How to OS new line char

am 28.08.2007 10:56:25 von Zanna

"Willem Bogaerts" ha scritto nel
messaggio news:46d3db09$0$228

> From the documentation:
> PHP_EOL (string)
> Available since PHP 4.3.10 and PHP 5.0.2

But removed over 5.1+?
I get an empty string from PHP_EOL :(

And I cannot find it in documentation...

Re: How to OS new line char

am 28.08.2007 12:51:18 von Zanna

"Fabio" ha scritto nel messaggio
news:46d3e32b$0$10628$4fafbaef@reader2.news.tin.it...

>> From the documentation:
>> PHP_EOL (string)
>> Available since PHP 4.3.10 and PHP 5.0.2
>
> But removed over 5.1+?
> I get an empty string from PHP_EOL :(
>
> And I cannot find it in documentation...

Sorry, I tested it better.
It works, but it is not documented! :(
I can find it only in the documentation that can be downloaded in the "Core
Predefined Constants" that does not exists on line and in all the web...

Re: How to OS new line char

am 28.08.2007 13:06:30 von Jerry Stuckle

Fabio wrote:
> "Fabio" ha scritto nel messaggio
> news:46d3e32b$0$10628$4fafbaef@reader2.news.tin.it...
>
>>> From the documentation:
>>> PHP_EOL (string)
>>> Available since PHP 4.3.10 and PHP 5.0.2
>> But removed over 5.1+?
>> I get an empty string from PHP_EOL :(
>>
>> And I cannot find it in documentation...
>
> Sorry, I tested it better.
> It works, but it is not documented! :(
> I can find it only in the documentation that can be downloaded in the "Core
> Predefined Constants" that does not exists on line and in all the web...
>
>
>

Well, it could be construed as "documented" - see
http://www.php.net/manual/en/reserved.constants.php

But I agree with you - this is not documented nearly well enough. It
looks like something which was added to the code but got lost in the manual.

Maybe a bug report to get it documented would be appropriate.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: How to OS new line char

am 28.08.2007 13:58:44 von Zanna

"Jerry Stuckle" ha scritto nel messaggio
news:2v-dnXoIVNean0nbnZ2dnUVZ_hWdnZ2d@comcast.com...

> Well, it could be construed as "documented" - see
> http://www.php.net/manual/en/reserved.constants.php
>

but... damn!
I searched it a lot and even the "search for" on www.php.net tell that exist
infos about PHP_EOL...

I don't know why the downloaded documentation is really more clear (not only
for this) that the one online that should be more detailed.

Thanks

Re: How to OS new line char

am 28.08.2007 21:03:08 von alvaro.NOSPAMTHANKS

Fabio escribió:
> Each OS has its new line chars:
>
> unix = \n
> mac = \r
> windows = \r\n
>
> Can I get the used one on the OS where php is running?

Be aware that knowing the OS EOL is not necessarily useful. In web
environment you handle files that are often created and used in
different systems.


--
-+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
++ Mi sitio sobre programación web: http://bits.demogracia.com
+- Mi web de humor austrohúngaro: http://www.demogracia.com
--