I am reading a book called "PHP, Apache, MySQL Web Development"
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=\"scrolle r\">\n";
while ($row = mysql_fetch_arr ay($result))
{
echo "<span class='commentn ame'>".
htmlspecialchar s($row['name']).
"</span><span class='commentd ate'>
(". date("1 F j, Y H:i", strtotime($row['comment_date'])).
")</span>\n";
echo "<p class='commentt ext'>\n".
nl2br(htmlspeci alchars($row['comment'])).
"\n</p>\n";
}
echo "</div>\n";
}
echo "<br />\n";
Why does the book put the "\n"s in there?
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=\"scrolle r\">\n";
while ($row = mysql_fetch_arr ay($result))
{
echo "<span class='commentn ame'>".
htmlspecialchar s($row['name']).
"</span><span class='commentd ate'>
(". date("1 F j, Y H:i", strtotime($row['comment_date'])).
")</span>\n";
echo "<p class='commentt ext'>\n".
nl2br(htmlspeci alchars($row['comment'])).
"\n</p>\n";
}
echo "</div>\n";
}
echo "<br />\n";
Why does the book put the "\n"s in there?
Comment