Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
35+ Techniques to enhance your php code (binarytides.com)
2 points by silv3r_m00n on April 5, 2012 | hide | past | favorite | 1 comment


A bunch of cargo cult ideas and otherwise terrible advice. Looks like it was written for PHP4.

There is almost no justification for any of these techniques and they don't come close to PHP best practices.

For example, "1. Do not use relative paths , instead define a ROOT path", what advantage does this provide? Use an autoloader. Furthermore:

  define('ROOT' , pathinfo(__FILE__, PATHINFO_DIRNAME));
Is completely redundant. If you move your file, you might as well just keep using your relative path.

I'm going to stop there.. but just about every technique misses the point.




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: