Something like this could also work. You'll need to do checking to make sure the second date is > the first date and handle appropriately, of course, but any dates that the function strtotime() handles should be usable.
function date_diff($first, $second) {
return (strtotime($second) - strtotime($first)) / 86400;
}
It takes the two dates, converts them to timestamps (in seconds), subtracts the first from the second to get the difference, and divides by 86400, the number of seconds in a day. Some tweaking should let you use that for what you need.