Archive for the ‘Useful’ category

Pad a number with leading zeros in PHP

August 19th, 2010

Just a quick one to share a couple of ways to pad a number with leading zeros… I’ve seen a lot of really poor examples of how to do this so I thought I’d share the two ways I might add leading zeros to a number in PHP.
» Read more: Pad a number with leading zeros in PHP

Validate Australian phone numbers in PHP

January 22nd, 2010

Here is a very basic PHP function to validate Australia phone (landline and mobile) numbers.

function validate_phone($number) {
	$number = preg_replace('/[^\d]/', '', $number);
	return preg_match('/^(0(2|3|4|7|8))?\d{8}$/', $number) 
		|| preg_match('/^1(3|8)00\d{6}$/', $number)
		|| preg_match('/^13\d{4}$/', $number);
}

Triple J’s Hottest 100 2009 Song List Previews

January 6th, 2010

When it comes to voting for Triple J’s Hottest 100 I always struggle to think of the songs I want to vote for. I know the songs if I hear them, but can’t think of the artist or title in most cases. A really useful thing would be a list where I can see all the songs I can vote for, with a preview of each next to it.

I haven’t been able to find anything like this so far on the ‘net, so my friend, Tommy, and I went ahead and made one! This is a list of all songs you can vote for in the 2009 Hottest 100, along with a YouTube video preview of each one.

Check it out here: Hottest 100 Song List with Preview. Hope you like it!