Well, the way you describe
KingWylim wrote:check the string first to see if it's a single digit number or a double digit number then if it's single digit I need to add a "0" to the begining
would work if you just wrote it in PHP instead of English, and would probably be a lot shorter - yep, 32 characters will do it.
But shorter still would be to use [man]sprintf[/man]. %02d