从现在到特定月份的PHP天数[重复]

Possible Duplicate:
Calculate number of days between two given dates

Is there a way to calculate the number of days between the current date and a specific month?

For example if the current date is March 25th 2011 and I want PHP to calculate the days between now and September 5th 2010.

Is there a function available for this?

EDIT

Also, I would like the year to be dynamic (so I don't have to define it) - so if the present date is September 20th 2010 it knows to count the same year - whilst if it's January 7th 2009 it knows that it needs to calculate the number of days between Jan 7th 2009 and September 5th 2008.

Your edit makes the question more interesting: how to find days since the nearest past September 5th. Here is one of many approaches:

$input=$argv[1];    //"now" for now.

$base=strtotime($input);

$t=strtotime("September 5");    //Defaults to current year

while(true){
    echo "t=".date("Y-m-d",$t)."
";
    $diff=$base-$t;
    if($diff>=0)break;
    //If diff is -ve, $t is still in future, so go back one year
    $t=strtotime("-1 year",$t);
    }

echo "Sep 5th is ".floor($diff/86400)." days before $input.
";

It is a commandline script, so you can test it like this:php test.php now gives "Sep 5th is 98 days before now." while php test.php 2000-01-01 gives "Sep 5th is 118 days before 2000-01-01." It does not support future dates though: php test.php 2020-12-31 gives "Sep 5th is 3405 days before 2020-12-31."