You are here: Re: \r and \r\n does not work! « PHP Programming Language « IT news, forums, messages
Re: \r and \r\n does not work!

Posted by monomaniac21 on 06/12/06 10:44

Thanks kimmo that's really helpful i never knew of the existence of the
<pre> tag.

Kimmo Laine wrote:
> "monomaniac21" <mcyi2mr3@googlemail.com> wrote in message
> news:1150105523.717839.133360@u72g2000cwu.googlegroups.com...
> > Hi im trying to create a csv file from a db and insert a new line for
> > each row. All the resources i can find say that the use of \r or the
> > use of \r\n are sufficient to generate new lines. However after trying
> > this for many hours i have come to the conclusion that this is not the
> > case. Can anyone suggest a better method for generating line breaks? or
> > tell me what additional code i may require to create line breaks in my
> > csv file?
>
>
> Could you please show your code sample. There might be something else that
> is causing the problem, not \r\n itself. For example there is a difference
> between using single quotes '\r\n' and double quotes "\r\n", only the latter
> form generates a linebreak.
>
> Another situation where linebreaks are often thought to be missing, is when
> you echo something to html code with linebreaks, which mysteriously
> disappear because any linebreaks in html are interpreted as whitspace and
> therefore reduced to a single space.
>
> <html><body><pre>
> <?php echo "here \r\n are \r\n some \r\n linebreaks \r\n for \r\n you"; ?>
> </pre></body></html>
>
> There is also a difference between different operating systems to what is a
> linebreak. As I recall it, CR is for Mac, LF is for Linux and Windows uses a
> combination of the two, CRLF. It's one of those things I'd fix in the world
> if I had three wishes.
>
> You might also do this:
> $crlf = "
> "; // now the variable $crlf contains one linebreak.
>
> // you can insert it into doublequote strings and it works:
> $character = "Fred{$crlf}Flintstone";
>
> HTH
>
> --
> "ohjelmoija on organismi joka muuttaa kofeiinia koodiksi" -lpk
> spam@outolempi.net | Gedoon-S @ IRCnet | rot13(xvzzb@bhgbyrzcv.arg)

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация