[Link] Excellent PHP best practices, 2014 style
Excellent post on This interests me: A collection of useful best practices in modern PHP development, like
- Redirecting the user via header() after a form submit (to prevent resubmitting POST data)
- Getting rid of the outdated mysql_* functions
- PSR-styles, like not closing PHP tags
- Anti-XSS
- DRY coding
- separating application logic and output
- using prepared statements instead of old-school mySQL queries
- using try/catch instead of die() and exit()
- working with git
- caching
- design patterns
- utf-8
- learning to love and use frameworks
- security
- application testing
- documentation
- server-side validation
- error reporting
and much more … This post will lift your development level dramatically. There’s a lot of stuff that could be added (like writing code that perfectly fits the PSR-guidelines, or Composer, or Vagrant), but in general the information given is extremely useful. Bookmark!