on 06/04/02 11:05 AM, Maxim Maletsky ([EMAIL PROTECTED]) wrote:
> 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.
Well, I've been at this PHP thing for 2 years, and like I said, "for as long
as *I* can remember, it's been <BR />". Perhaps it was introduced in PHP4,
perhaps earlier. I was not an in depth user of PHP3.
But I can't be "deadly wrong" :)
> 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 :-)
Again. I was only stating MY experience. "Every browser I can get my hands
on". I do extensive testing, and have never seen a <BR> or <BR/> or <BR />
misbehave.
If you have seen it perform unexpectedly, I'm keen to hear about.
In fact, if this is the case, then I'll be writing my own nl2br function
which returns a <br>, to avoid this problem ever again.
Perhaps in future releases, nl2br() should have an option flag for switching
between XHTML and HTML? I can't see why the powers that be would have
included XHTML compliance if it wasn't backwards compatible.
> when was it changed? Is there any reference?
I went to php.net/nl2br and this line of text was in there:
"Note: Starting with PHP 4.0.5, nl2br() is now XHTML compliant. All versions
before 4.0.5 will return string with '<br>' inserted before newlines instead
of '<br />'."
:)
So it would appear that I've only been using nl2br since I got my hands on
PHP4.05+, which according to the earliest date I can find, was released
sometime around 2001-04-30.
Justin French
--------------------
Creative Director
http://Indent.com.au
--------------------
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php