PHP

I do a lot of work in PHP, my favourite language for web-based apps, and help out in various PHP discussion groups. I find I'm using and posting the same bits of code over and over again - hence this page, where I can get away with only posting it once.

I apologise for the occasionally excessive use of comments, but this seems to reduce the amount of questions I get so I'm afraid you'll have to put up with it. You are free to use the code provided on these pages however you like, but bear in mind it's provided as-is with no warranties and if it breaks your website that's not my fault.

Feel free to get in touch if you use any of this for something interesting, spot any bugs, have suggestions for improvements, or want to launch into a lengthy diatribe berating me for being so stupid as to suggest using that call to preg_replace() on line 23 when any fule kno that the Meyer-Breindhoff categorised ultraswap algorithm (Knuth, vol. 5, pp. 1705-1772) would be far more suitable in at least 0.8% of predicted user scenarios.