One thing you should NOT do with PHP
I know how dangerous it is, but it’s out of habit. What am I talking about? Well, it’s probably one of the most common mistakes a PHP developer/programmer/user will find: an array in a loop. It happens to me all the time, no matter what I’m working with, let it PHP, Python or JavaScript. This is just a reminder to me and anyone who faces this problem: never build an array in a loop! The array will just overwrite itself, and it can be a very well hidden problem. This includes loops and nested loops (loops in loops)… unless you want the array to overwritten. There are instances where the array needs to be overwritten (the mysql_fetch_assoc function is a good example).
This whole post may sound silly, but I suggest you be careful with array building in loops! it won’t cause any major problems (with exceptions), but you will never get the result you want (unless you want to the array to be overwritten, like I said before).
Drieick
If you're new here, you may want to subscribe to my RSS feed. Thanks for visiting!








