I was struggling to find a bit of code in php to compute the number of days between today and a given date.  Here is the code you are after. Just simple use it or use it within a function

$today_date = date('Y-m-d');
$datediff = round(abs(strtotime($today_date)-strtotime($date))/86400);

 

If you want to use it as a function, here you go:

 

function datediff($date1,$date2)
{
return round(abs(strtotime($date2)-strtotime($date1))/86400);
//Remember date2 is the latest date and date 1 is older date to get +ve result
}