You are here: Re: [PHP] Printing \n and \r to the screen « PHP « IT news, forums, messages
Re: [PHP] Printing \n and \r to the screen

Posted by Dotan Cohen on 08/24/05 16:54

On 8/24/05, Jay Blanchard <jay.blanchard@niicommunications.com> wrote:
> [snip]
> I seem to be having trouble with \n and \r in variables. I write my
> code on a linux box, and the server is linux. So I should always have
> \n\r, no? Is there a way the I could print $variable; and have it show
> me the /n and /r 's ? I tried with a srt_replace() on /n and on /r,
> but they do not get replaced. I also tried escaping the backslash,
> then double escaping that as was suggested somewhere in the
> php.net/manual, then triple escaping!
>
> Thanks ahead of time for any insight.
> [/snip]
>
> Print to the screen? You could enclose them in single quotes '\n\r'. Are
> you tring to make these work in a web browser? Because if so it'll never
> happen, they do not show up. (but you can see the result when you view
> source) Anything output to the browser to represent this should have a
> <br> or <br />
>

I want to explode on newline in a text file, but explode("\n\r",
$ducks) wasn't doing it, so I thought that it would be good if I could
see where these ascaped characters are. I thought that Kate has a see
[tab|space|newline|carrage return] checkbox, but that must have been
in a different program.

In Jochem's post I see the mistake that I made. I should have googled
for that before I asked. The str_replace in that post worked, and now
I see where I erred. Thanks.

Dotan
http://lyricslist.com/lyrics/artist_albums/106/cantrell_jerry.php
Cantrell, Jerry Song Lyrics

 

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

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