Archive for the PHP Category
Published December 2nd, 2010
For several recent projects I’ve been called upon to produce output in PDF format. For a PHP coder the difficulty lies not in the task itself, but in choosing which of the numerous PDF generation libraries to use. I’ve tried several over the past 18 months or so, including FPDF and TCPDF. TCPDF is a direct [...]
Published June 13th, 2008
As part of my ongoing refactoring work (see previous post) and having decided to take a more active stand against broken windows syndrome I’ve been cleaning up various coding oddities as I’ve found them. Today I came across (something like) this little snippet: if( ! $obj = new myObject( $id ) ) { throw new [...]
Published April 24th, 2008
This is one of those silly little PHP quirks that catches me out from time to time, but apparently not often enough to avoid doing it again on occasion. Let’s say you have a function (we’ll call it getSomeData())that returns an array, or false if there is a problem (yes you should probably be using [...]
Published November 1st, 2007
Somebody asked for a very simple script that would scan a directory (and its subdirectories) for all images, and then present them all as a list of thumbnails. So I had a quick go and came up with this (zip file). Just place the two PHP files in the directory you want to scan, open [...]
Published January 4th, 2007
When you’re using a script to send an email (for example, from a contact form) it’s a good idea to break up long lines, because some email software won’t word wrap automatically — so continuous text is rendered on a single line that disappears off the edge of the screen. I’ve had to do this [...]
« Previous Entries