PHP is Obsolete

Posted on May 12, 2008

Far be it from me to predict the death of PHP, arguably one of the most popular languages for building web applications. It is practically guaranteed to be installed on any web host imaginable, is well documented online, and has a strong following of developers. Such factors would normally ensure the continued long life of a language. However, PHP is now officially way behind the curve and is risking becoming obsolete.

IBM Developer Works recently previewed the new features in PHP 6.0. Chiefly among them is the late introduction of name spaces. A fundamental OO feature, name spaces protect software developers from the trouble of co-ordinating the names of objects and variables in the software they develop together. The concept has been around since the late 1960’s and is present in every respectable language. Without it, managing large software projects becomes very difficult and aggravating.

Consider the following example code:

// I'm not sure why I would implement my own XMLWriter, but at least
// the name of this one won't collide with the one built in to PHP
namespace NathanAGood;

class XMLWriter {     // Implementation here... }

$writer = new NathanAGood::XMLWriter();

The grammar and syntax used is essentially lifted straight from Perl 4! It uses a keyword and argument to define a name space. It then uses the double-colon syntax for referencing names within the space (ie: “NathanAGood::XMLWriter()”). The only major difference is the keyword (Perl uses the “package” keyword). Other differences may surface in the implementation, but superficially it appears the same.

The reason why I am claiming the death of PHP is that it is introducing very fundamental language features many years behind the competition. In the technology world, you can get away with being a few months behind or maybe a year at most. However, it’s 2008 and PHP is only now introducing name spaces. I might have stayed with the development of PHP had it been baked with name spaces from the onset. It’s too late to be thinking about this stuff now when it is so common place and robust else where. PHP as a language still has a long way to go. The only thing keeping it going may simply be the footholds it has managed to entrench itself in. Only time will tell how long it can hold on.

Update in 2017

This article is nearly 10 years old. Guess what? PHP is still here! Surprise!

Here is a more up-to-date survey of the PHP landscape. Hope you find it enlightening.

Also when I converted this blog away from Wordpress using a custom script to convert it all to Markdown I seem to have broken many links. If you can find the original DeveloperWorks link to the PHP 6 announcement that would be awesome.