The July 2004 issue of Linux World contains an article entitled "PHP 5: Evolutionary or Revolutionary?" Since I've built several applications in PHP, I was curious to see what has changed and whether or not it truly is revolutionary. The leap from PHP 3 was indeed a large one and with it came huge performance and stability improvements. The other thing this got me thinking about is whether or not their "revolutionary" features are revolutionary in comparison to my technology of choice, ColdFusion.
According to NetCraft, PHP is now installed on over 15 million domains, so it's by no means the little-known scripting language it once was. It's especially popular amongst the open-source crowd, and it's more or less the technology of choice if you're doing web development on Linux with MySQL. I actually like PHP--it's quite powerful, has an impressive library of functions built in, and is pretty quick to develop with. I definitely don't shy away from it in freelance work like I do Classic ASP; it's fun to work with and I always get good results.
I was very curious to see the new features, because in some ways (OOP and XML being two biggies) PHP 4 is a bit behind the times. Not surprisingly these are the two major areas they've improved things with PHP 5.
One of the major complaints about PHP from developers of extremely large applications is that PHP's OOP features just aren't robust and capable enough. The main issue with the OO behavior in PHP 4 is that objects are always copied during assignments and parameter passing. Bad stuff in general, but particularly if you aren't aware that's what's going on. This can cause some freaky behavior that's pretty tough to debug, and the workarounds just aren't very satisfactory. In PHP 5 (specifically in the new Zend II engine) objects are now "handles" (like in Java or pointers in C++), which means you can throw objects in and out of functions, etc. and you always end up pointing to the same object. BIG improvement.
The other big improvement is in the XML functionality. They've added a new SimpleXML extension to greatly reduce the complexity of creating and parsing XML documents. A simple function call like $myXml = simplexml_load_file('filename'); will load and parse your XML file. Great, lovely, just what the doctor ordered. There's also a new SOAP extension that allows for development and consumption of web services natively in PHP 5. Again, nice addition.
What I go back to, however, is whether or not any of this is really a big deal. In the PHP world it certainly is, because now PHP is on par with other technologies like .NET, Java, and of course ColdFusion. Evolutionary? Definitely, but by necessity. Revolutionary? Hardly. There's nothing in PHP 5 that can't be done in other languages, and in ColdFusion you can do all these things and more far more simply.
I wouldn't get on my high horse but the final sentence of the article is as follows: "This new version [of PHP] only increases the challenge for its competitors to catch up." Catch up? Hardly! I've been able to do everything PHP can do in ColdFusion for quite some time now, and we're only a few months away from a new release of CF that will raise the bar even further. I welcome the new functionality in PHP, and I'll be darn happy it's there for my PHP projects, but I think all they've really done is caught up with this release. Given a choice I'd still go wtih CF whenever possible, but at least now PHP doesn't tie my hands or force me to kloodge things like I used to have to.