date_diff days code example
Example 1: Get the number of days between two dates in PHP
$startDate = new DateTime("2019-10-27");
$endDate = new DateTime("2020-04-11");
$difference = $endDate->diff($startDate);
echo $difference->format("%a");
Example 2: php get day diff
$now = time(); // or your date as well
$your_date = strtotime("2010-01-31");
$datediff = $now - $your_date;
echo round($datediff / (60 * 60 * 24));