3v4l.org

run code in 300+ PHP versions simultaneously
<?php $daysInMonth = array(0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $timestampFailing = false; for ($year = 1500; $year < 2000; $year++) { for ($month = 1; $month <= 12; $month++) { for ($day = 1; $day < $daysInMonth[$month]; $day++) { $baseString = sprintf("%4d-%02d-%02d 00:00:00", $year, $month, $day); $timestamp = strtotime($baseString); if (!$timestamp) { $timestampFailing = true; echo "Timestamp failing start at $baseString\n"; continue; } if ($timestampFailing && $timestamp) { $timestampFailing = false; echo "Timestamp failinng end at $baseString\n"; } $roundTrip = date("Y-m-d H:i:s", $timestamp); if ($baseString !== $roundTrip) { echo "$baseString ($timestamp) $roundTrip\n"; } } } }
Output for 5.3.0 - 5.3.29, 5.4.0 - 5.4.45, 5.5.0 - 5.5.37, 5.6.0 - 5.6.28, 7.0.0 - 7.0.20, 7.1.0 - 7.1.7, 7.2.29 - 7.2.33, 7.3.12 - 7.3.31, 7.4.0 - 7.4.33, 8.0.0 - 8.0.12, 8.0.14 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.6
1916-05-01 00:00:00 (-1693700372) 1916-05-01 01:00:00 1937-07-01 00:00:00 (-1025745572) 1937-07-01 00:00:28 1940-05-16 00:00:00 (-935022000) 1940-05-16 01:40:00
Output for 7.3.32 - 7.3.33, 8.0.13
Timestamp failing start at 1970-01-01 00:00:00 Timestamp failinng end at 1970-01-02 00:00:00

preferences:
204.88 ms | 401 KiB | 294 Q