Gruzin Posted September 9, 2006 Share Posted September 9, 2006 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] Link to comment https://forums.phpfreaks.com/topic/20223-replace/ Share on other sites More sharing options...
wildteen88 Posted September 9, 2006 Share Posted September 9, 2006 This should do:[code=php:0]$txt = str_replace(array("<br />", "<br>"), "\n", $text);[/code] Link to comment https://forums.phpfreaks.com/topic/20223-replace/#findComment-88943 Share on other sites More sharing options...
Gruzin Posted September 9, 2006 Author Share Posted September 9, 2006 [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? Link to comment https://forums.phpfreaks.com/topic/20223-replace/#findComment-88944 Share on other sites More sharing options...
AndyB Posted September 9, 2006 Share Posted September 9, 2006 This should replace them with nothing. Is that what you want?$txt = str_replace(array("<br />", "<br>"), "", $text); Link to comment https://forums.phpfreaks.com/topic/20223-replace/#findComment-88947 Share on other sites More sharing options...
Gruzin Posted September 9, 2006 Author Share Posted September 9, 2006 [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! Link to comment https://forums.phpfreaks.com/topic/20223-replace/#findComment-88948 Share on other sites More sharing options...
newb Posted September 9, 2006 Share Posted September 9, 2006 whats \n ? Link to comment https://forums.phpfreaks.com/topic/20223-replace/#findComment-88995 Share on other sites More sharing options...
coldkill Posted September 9, 2006 Share Posted September 9, 2006 It means newline. Link to comment https://forums.phpfreaks.com/topic/20223-replace/#findComment-89000 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.