mackin Posted March 21, 2012 Share Posted March 21, 2012 hi, i am using a database to populate a webpage with text. How do I make a function to add line breaks to the text? an example page I want to use it on it http://www.stayneartheairport.com/bandb.php?id=11084507&airport=manchester You can see the two text areas of description and facilities have no paragraphs or other formatting. I want the code to scan the text - and if there is say <br> - it will remove it an replace it with a line break. Link to comment https://forums.phpfreaks.com/topic/259447-make-php-function-to-add-line-break/ Share on other sites More sharing options...
smerny Posted March 21, 2012 Share Posted March 21, 2012 actually i just reread your post... not sure what you mean... <br> is a line break... so i'm not sure what you are wanting to replace <br> with.. $replacement = ?? $str = preg_replace('/<br\\s*?\/??>/i', $replacement, $str); }; Link to comment https://forums.phpfreaks.com/topic/259447-make-php-function-to-add-line-break/#findComment-1329957 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.