I am sure every PHP developer has a colleague they hate because he/she coded the application they started maintaining. This is mostly because the code is old. New standards become common, they learn what they used to do was inefficient, unreadable, or complicated. As PHP is a language that changed significantly over the years, code written a few years ago will certainly look outdated.
That being said, this post is not about the old PHP code. This post shows how to be a bad programmer even when following standards. Please don’t be this person.
- Too many nested if statements
- Extra brackets and braces
- Unnecessary casting
- Useless checks
- Slow PHP built-in functions
- Long functions
- Too many function arguments
- Long lines
- Long if-else blocks
- Wrong function / class name casing
- Lack of coding standards
Too many nested if statements
This is probably the one I hate the most. It also makes the lines too long because of the indentation caused by each of the nested if statements.