Even more PHP mistakes!

Tags:

I recently wrote a post about three PHP mistakes that can give you a bad headache. The blog readers commented even more mistakes, and there was a whole new article on another site with 8 mistakes of their own! This post is dedicated to the mistakes my readers posted in the comments, and lastly linking to the other mistake article.

Avoiding endless switch-case structures with classes

Tags:

Imagine the following: you have some form elements that need to render themselves. You have saved them in a database, as your users must be able to modify the forms. You have a bunch of different kinds of elements: a text field, a longer textarea field, maybe a field used for entering dates. How would you determine, which kind of …