history

Best practices in PHP when iterating over database results

Many PHP database libraries use a while loop with assignment to iterate over database results. In this article I’ll show why this pattern is so pervasive, why it opens the door for errors and what you can use instead.