lolsox Posted April 6, 2010 Share Posted April 6, 2010 Hi, I am using the nl2br function to create line breaks for text fetched from a mysql table. Is there any way to limit the line breaks created to max 2 line breaks in a row? Link to comment https://forums.phpfreaks.com/topic/197813-limit-line-breaks-created-by-nl2br-function/ Share on other sites More sharing options...
teamatomic Posted April 6, 2010 Share Posted April 6, 2010 No, look at str_replace, it has a counter that can be set. str_replace("\n","<br>,$line,2) would limit the conversion to 2. HTH Teamatomic Link to comment https://forums.phpfreaks.com/topic/197813-limit-line-breaks-created-by-nl2br-function/#findComment-1038070 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.