Hacker News new | past | comments | ask | show | jobs | submit login

This is in reference to "<br />" not "</br>"

The "/>" is syntax for a self-closing tag in xhtml (e.g. you were supposed to use <img src="" /> etc).

You see "<br />" a lot in php forums because these will often filter user input through the function nl2br whose purpose is to add HTML linebreaks wherever a person has a newline in their post. PHP's nl2br function by default inserts "<br />" unless you tell it specifically not to use xhtml-compatible linebreaks.




Wow that's odd. Also, PHP has a built in function for filtering filtering plain-text user input to create HTML? That's... not something I would have expected.


Sarcasm? PHP has a built-in function for any oddball thing you can think of.


Personal fav: gzgetss(). Reads a line from a gzip file handle and strips HTML tags from it. Why? I don't know!

http://php.net/manual/en/function.gzgetss.php


It's super useful. If you have a textarea for users to type paragraphs into you can use nl2br to output it more or less the same, but in HTML. (Be sure and escape the text before nl2br not after.)




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: