02
Nov 07

Reaching the limits of PHP

First off, I rather like PHP. PHP 5 at least, I think PHP 4 was – and remains – a dog’s dinner of a thing at best. But for 90% (at least) of webpages, PHP is a pretty decent solution. Retrieval of data from databases, display of that data, no worries. Minimal learning curve, support for high-level constructs like objects and exceptions, several frameworks available – PHP’s a damn good choice in the vast majority of cases.

Thing is, right now I’m trying to put together a bit of code to act as a proof of concept, and – more fool me – I tried to use PHP to do it, figuring I’d save some time. No such luck. Turns out, trying to create data in PHP is a lot harder than trying to manipulate or display it. Right now, I’m in the middle of implementing a recognition system using a variable order markov model approach, and just generating the PPM-C prefix trees is a total pain in the fundament. Even the basic data structure I’m using – a trie – has no standard implementation in PEAR or the SPL or anywhere else I could find. So first I have to write that. Then I have to write the code to do all the other stuff. I mean, granted, hoping to find a pre-written PPM library was a bit hopeful, but prefix trees are basic data structures (and yes, I eventually found some sample code for one, but I’m still having to kick that about a fair bit to get what I need from it). But there was other stuff that I tried and ran into problems with. For example, PEAR::Math_Matrix seems to be PHP4 only, and the PEAR version doesn’t want to even parse in PHP5, let alone let me look for determinents or jacobians or eigenvalues. Which put yet another crimp in my plans earlier this week.

Anyway, for the actual production version of this project, PHP’s obviously out and never was in the running. This piece of code has to run as fast as possible – so I’m looking at C++ or C or something of that nature. But for proof of concept, I was hoping PHP was the way to go. Nope. This horse does not do well on this course. I’m thinking it’s time to start playing a bit more with Python or Perl or something for this sort of thing in the future. Which isn’t horrible – better to have more strings to your bow if at all possible. But it does rather shoot the whole fanboy attitude in the PHP-vs-Ruby-vs-Python-vs-Whatever language wars. There’s simply no place for it in a professional environment, and it’s not of any real use anywhere else either.

Still gonna do that rifle club management system project in PHP with Symfony or Prado (if they get the menu component done and released in time) though.

(And someone needs to tell Sean Coates that Microsoft is still evil 🙂 )