I have a class I’m preparing for tomorrow at the 2006 GeoWeb conference on the use of SVG in GIS. I’ll be posting those notes tomorrow, but tonight, as I’m basically doing my damndest NOT to work on the class for tomorrow (serious procrastination issues here) I thought I’d just make a couple of quick notes about PHP5.

I have to admit it, I have more than a little bit of a bias toward the underdog, especially when that underdog isn’t just one big mega-corp going after another big mega-corp. I think that’s part of the reason I’ve always found myself cheering for PHP, even when I could readily admit that there were problems with the language. There were - PHP3 was, while not exactly slow, hardly known for its speed-demon like characteristics. It didn’t really have much in the way of oomph when it came to object-oriented programming, which, while I personally believe OOP to have an upper boundary to the level of complexity it can handle, I still think that most contemporary languages should be able to support OOP as a matter of course.

Yet my biggest pet peeve with PHP, something that kept me from adopting it in any meaningful way, was Sablotron, PHP’s erstwhile XSLT library. With Sablotron you had to install it directly, rather than as part of the normal install for PHP, which meant that for hosted sites, you were out of luck even getting it in many cases. The transformer was slow and buggy and non-standard, and while it has improved over the years, it was always something of an also ran within the XSLT world.

Indeed, my distaste with Sablotron was so great that I ended up invoking Saxon as an external process, one of the more painful operations I can think of doing in PHP, as you are essentially invoking the Java runtime every time you serve a web page. I DID eventually get it to work, but I have to admit that it was neither fast nor pretty.

Along comes PHP5, and I’m beginning to look very closely at it again for a number of projects. It’s surprisingly fast, and it gets faster with usage. The library that it supports is becoming quite impressive, from the panoply of GD graphics to practically every database known to man or woman, It has honest to goodness classes, not fake approximations, yet PHP5 still manages to work with them without compromising the type malleability that’s always been one of the languages better strengths.

Yet it is ultimately the newly revamped XML library that has me salivating. With 5.0, PHP has switched to the libxml2 library, and its companion piece, the libxslt. Now, Daniel Veillard, one of the principle people involved in both libraries, has long been one of my inspirations, largely for the work that he has done for getting XSLT into the hands of people. He spent a great deal of energy and time getting the C++ based libxslt compliant not only with the XSLT 1.0 specification, but with the entire EXSLT.org library, which provides most of the core functions that should have been in XSLT 1.0, and that for the most part is in XSLT 2.0.

With the libXSLT library (and its stand-alone alter-ego xsltproc) you can do such things server-side as convert XML tree fragments into colllections of nodes, you can create an XSLT template as a function callable from an XPath expression, you can save external content, bind PHP functions directly into XSLTs, invoke regular expressions and all kinds of other fairly useful features, largely by taking advantage of EXSLT.

What’s more, libXML2 is one of the fastest XML parsers/processors on the planet, and between that and the speed that PHP5 operates, I’m finding that my applications definitely are racing to get to the server. This set of libraries also supports SimpleXML (a simplified XML API that echoes the development of client-side E4X) and a decent XPath implementation.

Ruby of late has been getting most of the press (and admittedly, for very good reason) but I have a suspicion that PHP5 may be the sleeper of 2006 - a language that will continue making inroads into the enterprise as it picks up new fans for performance and functionality.

Kurt Cagle is a software architect, writer, and developer living in Victoria, British Columbia.