A new article this morning from Zend talks about one of the pitfalls that more advanced developers can fall into - when to use OO versus procedural programming in PHP.
In PHP, unlike many other languages, you can choose between using an object oriented (OO) or a procedural approach. Most PHP programmers use a procedural approach by default, since web pages themselves operate in a very procedural way (this tag, then this tag, then this tag). Interspersing procedural code with HTML is more straightforward, and so PHP programmers often develop their own style, based on this approach.
Of course, there are two sides to the story, but sometimes one wins out over the other - it really just depends on the useage. Fanatics on both sides will argue all day long on when to use what. There are, however, a few goals (directives) that need to be met for a piece of code, and sometimes there just is one way to do it best. They present examples for both kinds of development, complete with real-world software to demonstrate the power of each side of the coin...




