In this new post to the PHP 10.0 blog Stas has some responses to the recent suggestions from Google as to how to optimize your applications.
There are a bunch of advices there, some of them are quite sound, if not new – like use latest versions if possible, profile your code, cache whatever can be cached, etc. Some are of doubtful value – like the output buffering one, which could be useful in some situations but do nothing or be worse in others, and if you’re a beginner generally it’s better for you to leave it alone until you’ve solved the real performance problems.
He mentions four things that need amending from what Google suggests:
- Don’t copy variables for no reason
- Avoid doing SQL queries within a loop.
- Use single-quotes for long strings
- Use switch/case instead of if/else