3v4l.org

run code in 300+ PHP versions simultaneously
<?php $datestr = 'Fri, 28 Feb 2020 19:18:26 +010'; $date = new DateTime($datestr); $tz = preg_match('/([+-]\d+)$/', $datestr, $m) ? $m[0] : ''; $now = new DateTime(date('Y-m-d H:i:s ' . $tz)); $now->modify('-1 day'); if ($now > $date) { echo "$datestr is more than 1 day ago\n"; }
Output for 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.26, 8.4.1 - 8.4.13
Fri, 28 Feb 2020 19:18:26 +010 is more than 1 day ago

preferences:
156.11 ms | 407 KiB | 5 Q