> nl2br() has returned <BR /> for as long as I can remember.

You're deadly wrong, Justin. Years of coding and I have never seen this
behavior of nl2br(). Perhaps I missed its new behavior's introduction
(guilty as charged if so) but I only remember it returning me <BR> not
<BR>. I have several regex depending on it.

> As far as my limited knowledge goes, it's to do with the future.  XML
and
> related languages do/will require all single tags (ie not something
like
> <B></B> which has an open and close) to have the form <BR/>.

That's true, I suppose

> This would apply to things like <HR> <IMG> and many others.
> 
> I have no idea why it places the space in, but I do know that i've
done a
> LOT of testing and <BR /> works fine in every browser I've ever got my
hands
> on.

False!

It DOES NOT work fine in every browser. I'd love to give you a prov, but
because I am lazy I will just tell you this formula: 


if("I found this issue"=="I noticed screwed pages on my site") {
        All I did: preg_replace("<BR[^>]*>", "<BR>", $text); {  
                ...and pages became pretty again.
        }
}

/// preg 'couse I had no idea what comes up next :-)

> Of course, if you don't like it, you can add a str_replace in MANY
ways:
> 
> <?
> $text = nl2br($text);
> $text = str_replace("<BR />","<BR>",$text);
> ?>

yup

 
> So, to answer your Q, it's a normality.  Sorry I can't provide a full
reason
> why :)
> 


when was it changed? Is there any reference?

 
> Justin French
> --------------------
> Creative Director
> http://Indent.com.au
> --------------------
> 
> 
> 
> 
> on 06/04/02 10:13 AM, Maxim Maletsky ([EMAIL PROTECTED])
wrote:
> 
> >
> > I've never seen that nl2rb would return me <BR /> instead of the
> > traditional <BR>. But it did.
> >
> > Is that normal or it that a bug?
> >
> >
> > Here's some test code:
> >
> > <?
> >
> > $text = "
> >
> > Hello
> >
> > this is
> > the
> > silliest
> >
> > test
> >
> > I can
> >
> >
> > ever
> >
> > invent
> >
> > ";
> >
> > echo nl2br($text);
> >
> > echo "on machine: $SERVER_SOFTWARE";
> >
> > ?>
> >
> >
> > returns me such HTML:
> >
> > ----------
> >
> > <br />
> >
> > <br />
> > Hello
> > <br />
> >
> > <br />
> > this is
> > <br />
> > the
> > <br />
> > silliest
> > <br />
> >
> > <br />
> > test
> > <br />
> >
> > <br />
> > I can
> > <br />
> >
> > <br />
> >
> > <br />
> > ever
> > <br />
> >
> > <br />
> > invent
> > <br />
> >
> > <br />
> > <p>on machine: [Apache-AdvancedExtranetServer/1.3.22 (Mandrake
> > Linux/1.2mdk) mod_ssl/2.8.5 OpenSSL/0.9.6 PHP/4.0.6]
> > ----------
> >
> >
> >
> > I've triple-checked for what ANSI characters I had there. They were
> > fine. And as you can read below, there were the same as when nl2br
used
> > to return me <br>.
> >
> > The problem has never occurred to me on any of the previous machines
> > site was hosted on. It does on this one though, with even the same
> > version of PHP and the same data from DB. I've noticed this problem
> > because I had a RegEx after nl2br() that always worked till we
migrated
> > on a new server, then my expression has obviously stopped to work
> > because of that extra space and slash nl2br kindly provided me with.
> > Temporarily fixed with another RegEx. But, I was wondering, is a
known
> > bug or it's because of my machine? Other than that nothing has
> > changed...
> >
> > Enlighten me on this, please. Did I miss a bug report?
> >
> >
> > Sincerely,
> >
> > Maxim Maletsky
> > Founder, Chief Developer
> >
> > PHPBeginner.com (Where PHP Begins)
> > [EMAIL PROTECTED]
> > www.phpbeginner.com
> >



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to