PHP as a web language
My first grudge against PHP is it's not a very generic language. People have successfully written non-web-based PHP applications, but this seems to be more of a PHP programmer, who doesn't want to learn a more robust language. After a brief scan of various PHP support sites, PHP development outside the realm of web development is basically negligible. I see no reason, in fact, besides some amazing library I might not be aware of, for me to use PHP for a non-web-based application.
PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML. -http://www.php.net/
The syntax is ugly, in my opinion: requred semi-colons, arrows instead of periods to reference data, global functions to manage things like arrays instead of a more object-oriented approach, etc. After several iterations of the language, features seem tacked on to the early implementations. With python being faster and providing a larger development community, what motivates me to use PHP?
The MVC architecture
The MVC architecture is a design philosophy of separating the application into three sections: the models, which manage the data of the application; the views, which typically represent the user interface of the application; and the controllers, which handle a lot of the management between the views and models. While this design can be strictly conceptual to a programmer separating out functionality, various frameworks like Qt and CodeIgniter strictly separate these entities. Here's where I believe php has lost it's magic.
The main allure of PHP that stole a lot of perl's magic was putting the controller elements doing the processing directly into the html. Instead of managing large perl files mixed with html, people could make a mostly html-based file with a little PHP, which was much cleaner to read. In that sense, all the view implementation was usually separated from the model and controller. This seemed great at the time, but as MVC has gotten more prevalent, more and more PHP frameworks remove model/controller components from the html leaving small bits and pieces in its place. In my experience, and what seems to be the practice now in PHP, large controllers and models are created completely separate to the actual html. This creates a more coherent architecture, but it raises the question: now that we've moved so much PHP code away from html, why are we still using PHP?
The rise of templates
Templating libraries have been around for many, many years-even before PHP was popular. However, since some programming language had to drive the application anyway, I believe, there was no reason to use one if one had to do his/her coding in C/C++ or perl still. Now, however, many new languages have emerged such as ruby and python that provide a very small and more robust scripting experience. Because they are so general purpose, many more examples exist outside of web development. This is important as web applications have continually provided more and more functionality than just serving up semi-static web pages. The little bits of php code that was once in my html files are now easily replaced with some templating library like mako or genshi, and I can program in a more general-purpose language, whose techniques will apply to non-web-development tasks as well. Again, now that PHP has been moved outside of html, why should I use it over python or ruby?
Things I'll miss
Alas, PHP, I hardly knew thee. One thing I'll slightly miss, though, is the startup time in PHP. Almost every apache configuration on Linux typically comes with PHP configured. After opening up a .php file and typing a few lines, I can access the file directly in my web browser and I'm immediately seeing the results. With python, I have to do a little bit more typically to get things running via apache. This requires setting up a cgi-bin, creating a proper script alias, etc. Newer python frameworks like web.py and turbogears now come with a mini-web-server included, however, so I can hold off on configurations until I'm farther in to production.
I'll also miss PHP's documentation, which I believe is generally more accessible than python's. Many of PHP's functions get an entire page dedicated to them like explode(). The page features the basics you'd expect from an API doc--parameters, description, and return value--but includes a huge swath of examples of how to use the function. It's like an entire programming cookbook dedicated to that function. I find a lot of python docs to be a little too wordy (ex. datetime and difficult to browse to a particular function--especially if I'm searching by functionality and not name. If I'm unfamiliar with a language, I'd like to know what functions are available for a given class before treading through each and every description. The function name should typically provide sufficient description to investigate it further. Anyway, the PHP wiki/comment style of documentation is something I hope more languages adopt. Wikis are already prevalent on many projects, but it seems people are much more willing to contribute through a brief comment box instead of stepping into an entire editing mode. Is it fear? Laziness? Regardless, it seems more accessible to contribute something beneficial to the doc.
Anyway, PHP. Thanks for everything. It was fun while it lasted.