This has cropped up alot on the board...in fact we had a mini code competition along similar lines
All months have 4 weeks at least, so all you really need to do is
$weeks = "4." . date("t", $timestamp) % 7;
to add on the remainder. date() takes care of leap years for you too.