php diff between two dates code example
Example 1: php compare two dates
$today = date("Y-m-d");
$expire = $row->expireDate; //from database
$today_time = strtotime($today);
$expire_time = strtotime($expire);
if ($expire_time < $today_time) { /* do Something */ }
Example 2: date diff php
$datetime1 = new DateTime('2020-10-11 16:52:52');
$datetime2 = new DateTime('2020-10-13 16:52:52');
$interval = $datetime1->diff($datetime2);
echo $interval->format('%a days');