What paradigm should PHP applications embrace?
PHP is one of the most used web development programming languages in the world, and from its original creation in 1995 has evolved much both as a platform, with drivers for nearly every existent database, and as a language itself, with the introduction of several new programming paradigms.
At first, PHP was all procedural and proposed structured programming as a solution for every business problem. In this period of its life, PHP was still a language for interactive documents as web applications did not exist yet. Content Management System and open source products like Drupal, Wordpress and phpBB made their fortune on their feature's quality, built over a procedural Api. But also most of the legacy code we work with now in 2010 follows the procedural paradigm, as it was the first paradigm supported.
With PHP 5, released in 2004, came the support for object-oriented programming in PHP. In PHP 4, the object engine was a joke, while PHP 5 borrowed much of Java's paradigm and transplanted it into the environment of a dynamic language. It was this shift that makes PHP frameworks possible now.
Every modern PHP library built with userland code we encounter offers an object-oriented Api. Contrast this with C extensions, which usually are still based on primitive functions, with quite a few well-thought exceptions like PDO and SPL.
In 2009, PHP 5.3 become the latest official, stable branch, and between its innovation we find an implementation of the functional paradigm, with anonymous functions and their specialization as closures being now supported by the language itself. Functional programming is based on functions instead of classes as the basic unit of computation, but treats them like first-class citizen by passing them around in variables and composing them dynamically. Functional programming also targets parallelization, due to its natural lack of shared state between functions.
But with PHP 5.3, also the invulnerable phantom of spaghetti code haunted PHP developers: the GOTO construct was now supported. The limited ability of make a certain subset of jumps was now in the hands of a population of developers that mostly lack a formal training.
Thus PHP supports nearly every programming style you can imagine. What do you feel should be the direction of the language and its APIs? What will become the dominant paradigm in the next years?
(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)