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
[EMAIL PROTECTED] 

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" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED].
> ..
>> 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
[EMAIL PROTECTED] 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to