Things in PHP that will save you time and frustration
These are functions I knew about for some time but never really used, it's very useful though.
Function: htmlspecialchars_decode()
What you might have been using: Something along the lines of str_replace('>','>',$string);
Why you should use this: less lines of code
-------------------------------
Constant: PHP_EOL
What you might have been using: "\r\n" or "\n", depending on your platform
Why you should use this: portability! Your file reading code suddenly becomes compatible with both Windows and Linux based servers.
-------------------------------
Function: nl2br()
What you might have been using: str_replace("\n","<br />",$string) or str_replace(PHP_EOL,"<br />",$string) at best
Why you should use this: nl2br does all the work for you, it means "newline to <br />", what more do you need?
-------------------------------
Function: wordwrap()
What you might have been using: too long to write down
Why you should use this: does all the work for you again, it is perfect for wrapping long texts to a readable format instead of forcing your users to scroll.
