Archive for the PHP Category
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 Exception( ‘Not [...]
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 exceptions, [...]
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 several [...]
Published November 28th, 2006
A couple of weeks ago I mentioned that PHP 5.2 would have support for tracking the progress of file uploads. However, when I went looking for signs of this new functionality I came away empty-handed and rather confused. It’s definitely there in the release notes, but I just couldn’t find any reference to it anywhere [...]
« Previous Entries