It's been well over a year since anything like this has been done here and I understand some of you lot are getting into summer holidays; there's some fresh blood in the water, too, as well as people who remember previous challenges. So here's a wee thing for your amusement (if you're the sort of person who finds programming amusing). It's not so much a challenge as an exercise, but I hate exercise and the others were called challenges, so...
It's not going to be Yet Another Web App. Frankly, such things are so bread-and-butter these days that there are (perhaps, in the case of PHP, too many?) programs that generate the things now (they're called "frameworks") and more effort is expended on understanding them and getting them to work than actually getting anything done. I guess chances are good that there are generators for this task as well, but heigho....
If you've read the subject line you'll probably already know what the task being set is: implement the classic ELIZA program. I did a Google search the other day for implementations and found nearly a dozen very quickly, in languages ranging from Prolog to JavaScript, so if you're looking for a model to follow you shouldn't have any difficulty finding one you can grok. For such a venerable program there is naturally going to be some variation, but again there is so much information on the subject to clarify what the baseline requirement is (ELIZA is supposed to mimic (or satirise) a "Rogerian Psychiatrist" whom I presume operates by rephrasing as a question what people say and bouncing it back to them). Chances are some of you have already written something like this.
That's the baseline; if you're looking to extend it (remember that ELIZA itself dates from 1967, and was only a couple of hundred lines) then you're more than welcome. But don't think I'm asking you to write HAL (I don't have anywhere to put it for starters, and I don't think Canterbury Univeristy will lend me Blue Fern). An example of such a frill that just occurred to me: some implementations of ELIZA have its dialogue rules stored in a script file separate from the program: I wonder if an XML format would make it easier to describe a richer grammatical structure?
Unlike previous challenges where obfuscation was the goal, this time it's good code that gets the points. Good? Aesthetically pleasing. Lucid; concinnitous. You know "good" code when you see it.
Yes, I'm being vague. It's diversity that I'd like to see. Whatever paradigm you like (remembering that you'll be expressing it in PHP!).
Extensions? Well ... only those that don't require additional dependencies outside a PHP 5.2 / PECL distribution.
Is this a web-based or a command-line user environment? Your choice.
If you do go for the web interface, I'll expect clean client-side code as well. Ajax? Yeah, though since as noted ELIZA itself has already been implemented in Javascript you might want to restrain yourself from putting too much of the work onto the client.
Oh, and when you've done all that: there are just a couple of changes I'll want to make. Just to make sure that this is specifically a PHP coding challenge and not just an exercise in good programming (or even just translating a program from one language to another). Let you know what those are a little later.
EOWAFFLE;