Hi guys,
I need a method that calculates the beginning/ending Unix time of today. This is the algorithm I used but it seems to have some problems (not syntax error, it just seems to be wrong at some cases, I haven't figured it out why!)

$begin = mktime (0,0,0,date("m",time()),date("d",time ()),date("Y",time()));
$end = $begin + 86400;

And one similar method for identifying the begin/end unix time within the last 7 days from current time (today)

$end = mktime (0,0,0,date("m",time()),date("d",time())+1,date("Y",time()));
$begin = $end - 7*86400;

So could anybody help me here
Any help, suggestions for better algorithm are needed