3 ms·
> review is more, than welcome. You opened the door, so here is my feedback: - You never have to explicitly define any of the super globals as global... you c
by Nycto 16y ago
> review is more, than welcome.
You opened the door, so here is my feedback:
- You never have to explicitly define any of the super globals as global... you can delete any line that says "global $_SESSION;", for example
- The database interactions look like they are heavily dependent on global state. It is also a tightly coupled dependency
- Use __construct for constructors instead of the class name: http://www.php.net/manual/en/language.oop5.decon.php http://www.php.net/manual/en/language.oop5.decon.php
- Foreach is better than a for loop for iterating over arrays
- Single character variable names only make code more confusing. You write code once, you read it a dozen times.
I challenge you to rewrite this with only using classes (no global functions) and to write unit tests for your code. Remember, if you have to jump through hoops to test your code, you need to rethink what you're doing.