RE: [PHP] What is new line? \n? \j? 13? 10? 15?
| From: | David Robley | Date: | Fri, 08 Sep 2000 01:03:28 +0000 |
| Subject: | RE: [PHP] What is new line? \n? \j? 13? 10? 15? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-15809@lists.php.net to get a copy of this message | ||
On Thu, 07 Sep 2000, Maxim Maletsky wrote:
> try to run this:
>
>
>
> for($i=0; $i<256; $i++)
> echo '<br>Caracter '.$i.'
> --><b>'.chr($i).'</b><--
> ';
>
>
>
> and you'll see that the only ANSI characters recognized as newlines by both
> MAC and WIN are 12, and 13...
> but is it a standart so whatever your system is 10 and 13 will ALWAYS and
> THE ONLY be newlines, or perhaps on a different OS it will be a #123 instead
> 10.. ?
>
> This is a question ... yet unanswered to me ...
>
> Cheers!
You may be getting confused here between new line, or linefeed as it is
also known, and the end of line character[s].
First, you are making an incorrect assumption from the results produced by
your little routine above. In fact, ASCII 13 is a carriage return, and ASCII
12 is a form feed character, which may look the same as a carriage return
when printed to screen, but is a completely different kettle of fish :-)
These terms relate back to the days of line based printers and an era when
sometimes your only I/O to a computer was a teletype. Carriage Return
represented returning the print head to the beginning of the _current_ line
and Line Feed represented rolling the paper up to the next line without
returning the print head to the beginning of the line. Form feed of course
would feed paper through until the printer reached where it thought a new
page might begin.
Now for the end of line; this is represented differently in different OSes
by one or more of carriage return CR (ASCII 13) and line feed LF (ASCII 10).
MSDOS and its offspring use CR LF, unices use LF and I believe Mac uses CR.
Any more of this and I'd be lecturing :-) but that should put you on the
right track. You might want to grab a listing of ASCII codes and have a
look therein.
--
David Robley | WEBMASTER & Mail List Admin
RESEARCH CENTRE FOR INJURY STUDIES | http://www.nisu.flinders.edu.au/
AusEinet | http://auseinet.flinders.edu.au/
Flinders University, ADELAIDE, SOUTH AUSTRALIA