I have these 2 lines:
printf ("id: %s Date: %s First Name: %s Last Name: %s\n",
$row[0], $row[1], $row[2], $row[3]);
print ("\n");
the newlines don't work.
i see there is a function nl2br to convert newlines to <br>
how do i use this?
prinft - nl2br
Moderator: General Moderators
If you use Windows, it shouldn't.allelopath wrote:the newlines don't work.
Windows seperates the lines like so: \r\n
So try that, if not, do what I like to do and simply add <br> (or <br />). It's a bit more universal than line breaks.
This is mainly used for changing line breaks in submitted data (such as this reply box in the forum, that I'm currently typing in). If you run a field such as $_POST['messagebox'] through [php_man]nl2br[/php_man](), every instance that someone hit enter within that box, the function will replace it with <br>. More info at the manual page.allelopath wrote:i see there is a function nl2br to convert newlines to <br>
how do i use this?
Note: Starting with PHP 4.0.5, nl2br() is now XHTML compliant. All versions before 4.0.5 will return string with '<br>' inserted before newlines instead of '<br />'.