Re: "\n" in PHP
From: Lc (hoho_at_not.me)
Date: 07/11/04
- Next message: Matthias Scheller: "Re: variable vs URL"
- Previous message: Gary L. Burnore: "Re: "\n" in PHP"
- Maybe in reply to: Mudge: ""\n" in PHP"
- Next in thread: bonehead: "Re: "\n" in PHP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 11 Jul 2004 20:45:01 +0200
"Lc" <hoho@not.me> a écrit dans le message de news:...
> Quite easy to understand:
>
> look at the code generated by your web server after php code has been
> interpreted (view source in your IExplorer menu).
>
> When you use /n, the code continues on a new line.
> If you don't use /n, the code continues on the same line.
>
> In your example /n is used to facilitate the reading of the HTML code
> generated by the web server.
>
> If you use SQL database, /n will be usefull to introduce "new lines" in a
> single text stored in only one field of your database...
>
>
> "Mudge" <mark1822@hotmail.com> a écrit dans le message de
> news:%3fIc.69637$Oq2.39135@attbi_s52...
> > I am reading a book called "PHP, Apache, MySQL Web Development"
> > http://www.wrox.com/WileyCDA/WroxTitle/productCd-0764557440.html
> >
> > and in its example code it sometimes will have a "\n" in it. It is
driving
> > me crazy because php will ignore the "\n"s so i have no idea why this
book
> > has them in there. Does anybody know?
> >
> > For example:
> >
> >
> > if (mysql_num_rows($result))
> > {
> > echo "<div class=\"scroller\">\n";
> > while ($row = mysql_fetch_array($result))
> > {
> > echo "<span class='commentname'>".
> > htmlspecialchars($row['name']).
> > "</span><span class='commentdate'>
> > (". date("1 F j, Y H:i",
strtotime($row['comment_date'])).
> > ")</span>\n";
> >
> > echo "<p class='commenttext'>\n".
> > nl2br(htmlspecialchars($row['comment'])).
> > "\n</p>\n";
> > }
> > echo "</div>\n";
> > }
> > echo "<br />\n";
> >
> >
> >
> > Why does the book put the "\n"s in there?
> >
>
>
>
- Next message: Matthias Scheller: "Re: variable vs URL"
- Previous message: Gary L. Burnore: "Re: "\n" in PHP"
- Maybe in reply to: Mudge: ""\n" in PHP"
- Next in thread: bonehead: "Re: "\n" in PHP"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|