Hello:
I have a question regarding "\n" and break tag "<br />".
I would like to know what's the difference between the two. Could you explain the difference. Give me some live code demo. If you can recommend online resources on escape characters that would help me to understand better. Thanks!
a) I thought the newline eacape character will generate a newline and text follow it will automatically goes to the next line. Actually it is not.
My code example:
<?php
echo "hello world \n\n";
echo "this is a php script.";
?>
b) I also see "\n" is being used to crate a table in PHP code. what would happen if newline character is omitted?
while ($rows = mysql_fetch_assoc($result) )
{
echo "<tr>\n";
foreach ($rows as $value)
{
echo "<td>\n";
echo $value;
echo "</td>\n";
}
echo "</tr><br />"; //break into next row
}
echo "</table>\n";