Re: New-line characters

From: Date: Fri, 05 Apr 2002 11:18:54 +0000
Subject: Re: New-line characters
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-91689@lists.php.net to get a copy of this message
FYI: <br><br> is not same as <p>. P is paragraph and br is just a line break of the text. So, depending on your text format the lines broken twice might (normally ARE but not too noticeably) look different. try to mess with CSS and you'll see the difference about how browsers see those both ways. In the poster's case, to have a <p> out of <br><br> he should still use nl2br() and then add this to it: $text = preg_replace("/\w*<br>\w*<br>\w*/i", "\n\n<p>", $text); Cheers, Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com maxim@phpbeginner.com Jamie Watt writes:
You'de be better off using the built in nl2br() function (http://www.php.net/manual/en/function.nl2br.php) it'll have the same effect as a it'll insert a <br> tag everwhere a newline character occurs. Where 2 newline characters occur it will produce <br><br> which in your HTML will break your text in the same way that a <p> tag would. "James Stewart" <JStewart@jubilee2000uk.org> wrote in message news:E7ACE637F3E5D211AFB50080C86DF8812826D3@j2000_nt_srv1.jubilee2000uk.org. ..
Hi, I have a form for users of a system I am developing to add their
newsletters
to a MySQL database through. I take their input and INSERT it straight
into
the database after adding slashes. When I retrieve the information from the database I would like to replace double occurences of new-lines with a <p> tag. Can anyone tell me what regexp I should be searching for? cheers. James.
-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Maxim Maletsky Founder, Chief Developer PHPBeginner.com (Where PHP Begins) www.PHPBeginner.com maxim@phpbeginner.com

« previous php.general (#91689) next »