Re: Extra spacing with <br> in HTML

From: Date: Sun, 28 Jul 2002 08:08:31 +0000
Subject: Re: Extra spacing with <br> in HTML
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-110035@lists.php.net to get a copy of this message
on 28/07/02 12:53 PM, Jason Stechschulte (stech@ypisco.com) wrote: > There might be an easier way, but you might just have to write your own > code for this. Something along the lines of: (completely untested) > > <?php > $line = ereg_replace("(^li|^ul|^ol)>\n", "<br />\n", $line); > ?> Definately an easier way (IMHO) -- just let nl2br() do what it does, then replace the problematic </li><br /> with just a <br />: <? $original = "<ul><li>Blar</li></ul>"; $new = nl2br($original); $new = str_replace('</li><br />', '</li>', $new); ?> Justin

« previous php.general (#110035) next »