Jump to content


Photo

carriage return and line feed diff


  • Please log in to reply
3 replies to this topic

#1 atitthaker

atitthaker
  • Members
  • PipPipPip
  • Advanced Member
  • 52 posts
  • LocationBanglore, India

Posted 18 August 2006 - 12:19 PM

I am understanding that there is difference between line feed and carriage return but I am not getting the desired output.

"This is \nsample string."

shall print
This is
        sample string.

and

"This is \rsample string."

shall print
This is
sample string.

Right?
But I am getting next line from the first column only.

Plz help...
Beginner with PHP and need help

#2 AndyB

AndyB
  • Staff Alumni
  • Advanced Member
  • 5,465 posts
  • LocationToronto

Posted 18 August 2006 - 12:24 PM

Think about a typewriter.  A line feed moves the print head down. A carriage return moves the print head to the extreme left.  A line feed AND a carriage return (\r\n) moves the print head down AND to the left.
Legend has it that reading the manual never killed anyone.
My site

#3 Jenk

Jenk
  • Members
  • PipPipPip
  • Advanced Member
  • 778 posts

Posted 18 August 2006 - 12:36 PM

now also bear in mind it varies across platforms.

*nix is just \n
windows is \r\n
and mac is strangely \n\r

#4 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 18 August 2006 - 12:50 PM

and mac is strangely \n\r


I believe Mac is just \r or have I misunderstood something....




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users