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"; }

preferences:
137.43 ms | 405 KiB | 5 Q