I'm trying to create a for loop that will run backwards through time based on dates, and a cycle that the user has chosen. I seem to be bringing our mail server (my test box) to its knees every time I run this script so be weary...Note, I need to work backwards in order to be exact

$unix_start
$unix_end
$cycle (month/week/year/quarter... etc)

switch $cycle
case month:
for ($unix_end; $unix_end > $unix_start; mktime(0,0,0,date("m",$unix_end)-1,date("d",$unix_end),date("Y",$unix_end))
{
// do something
}

I've worked qhite a bit with this, changing from Y to y and M to m etc and I typed this example in here so I'm sure there's syntax problems, what I really need to know is: will it work or am I out on a limb here.

Ulysses