Posts about the server side scripting language PHP

PHP TestFest UK 2010 And Testing PHP

Wednesday, September 29, 2010 - 23:16

The UK PHP TestFest this year was held at MadLab in Manchester on the 11th September. I was one of the 12 people who went along to learn about testing the PHP language. So I thought that I would collate some of the things that we went through during the session.


Print Image With Fixed Aspect Ratio In PHP

Monday, September 20, 2010 - 10:33

When displaying images added by users it is quite often necessary to resize them in order that they fit into a specific area of the page. Not doing this can cause problems with the images breaking the page layout. The trouble is that if you resize the image absolutely you tend to squash and distort it.

The following function can be used to calculate the width and height of an image to the correct aspect ratio, which will preserve the contents when printed out. This function makes use of the getimagesize() function, which is available as part of the GD library in PHP.


PHP Version Number

Saturday, June 26, 2010 - 00:55

Different functions and options are always being added to PHP. Although new versions generally don't create much backward compatibility issues it is usually prudent to write production code that you know will work on servers running a slightly older version of the language.


PHPNW 2010 Tickets Now On Sale

Sunday, June 20, 2010 - 22:24

Saturday 9th October 2010 will see the third PHPNW conference in Manchester, a conference devoted to all things PHP. PHPNW is a community of web developers, web designers and anyone else interested in PHP, from the North West of the United Kingdom. The monthly meetup is held on the first Tuesday of every month in the Revolution bar in Deansgate Locks. There is also an active mailing list.


Find A Month From A Given Integer With PHP

Monday, June 7, 2010 - 17:28

If you need to know the month from a given integer (from 1 to 12) then you can use the following snippet. This will return the string "Feb".