Dear all,
I use the function "nl2br to change to "<br>" code from the NEWLINE character, however, the final code is "<br />", why? please give possible solution, thanks
Regards, Simon
because <br /> is the xhtml version of <br>
... and XHTML is what you should try and use. The folks over at Zend helpfully fixed this function to use XHTML. Nice job, guys.
Norm
If the html is used, which function is appropriate for changing NEWLINE to "<br>" for html code.
Originally posted by apcmlee Dear all, If the html is used, which function is appropriate for changing NEWLINE to "<br>" for html code. Regards, Simon
prob the easiest way would be to use nl2br() and str_replace()
$foo = str_replace('<br />', '<br>', nl2br($text));
Originally posted by Norman Graham ... and XHTML is what you should try and use. Norm
thats controversial 🙂
http://www.hixie.ch/advocacy/xhtml
<br>, <br /> the result is same isn't it? You break the line with both of them...
Originally posted by rehfeld thats controversial 🙂 http://www.hixie.ch/advocacy/xhtml
I've never had any difficulties with IE6 and XHTML. I only use XHTML and I use the W3C XHTML validator. Everything works perfectly in IE6 - and of course Netscape, Firefox, Opera, Konqueror and so on and so forth.
Are there any problems, anyone? I'm not aware of them.
Norm 🆒
...I use nl2br function in a lot of applications and no one ever complained and some of them are viewed over the whole variaties of operating systems and browsers...
I really can't see the problem with using <br /> over <br> or the other way around....