Jump to content

Archived

This topic is now archived and is closed to further replies.

Gruzin

replace <br>

Recommended Posts

hi guys,
I geting data from db and I don't want to display [nobbc]<br>[/nobbc], [nobbc]</br>[/nobbc] etc... I've tryed php.net and phpfreaks, here is my effort, but think I am not on the right way. Thanks in advance.

[code]$txt = preg_replace( "<br />", "/\n/", $txt );
$txt = preg_replace( "<br>", "/\n/", $txt );
echo $txt;[/code]

Share this post


Link to post
Share on other sites
This should do:
[code=php:0]$txt = str_replace(array("<br />", "<br>"), "\n", $text);[/code]

Share this post


Link to post
Share on other sites
[quote author=wildteen88 link=topic=107465.msg431186#msg431186 date=1157811408]
This should do:
[code=php:0]$txt = str_replace(array("<br />", "<br>"), "\n", $text);[/code]
[/quote]
Tnak u very much, br is not any longer displayed, but still there is an empty line (br) between the text lines, any ideas what should I add that code?

Share this post


Link to post
Share on other sites
This should replace them with nothing. Is that what you want?
$txt = str_replace(array("<br />", "<br>"), "", $text);

Share this post


Link to post
Share on other sites
[code]$txt = str_replace(array("<br />","
", "
"), "", $text);
echo $txt;[/code]
this works for me. Thanks andy :) think u guys have helped me for 100000... times, really learning something!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.