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; $errorCount = 0; for ($year = 1500; $year < 2000; $year++) { for ($month = 1; $month <= 12; $month++) { for ($day = 1; $day < $daysInMonth[$month]; $day++) { if ($errorCount > 10) { echo "too many errors."; exit; } $baseString = sprintf("%4d-%02d-%02d 00:00:00", $year, $month, $day); $timestamp = strtotime($baseString); // Currently failing, ignore if (!$timestamp && $timestampFailing) { continue; } // Newly failed: log and continue if (!$timestamp) { $timestampFailing = true; $errorCount++; echo "Timestamp failing start at $baseString\n"; continue; } // Stopped failing: log and continue if ($timestampFailing && $timestamp) { $timestampFailing = false; $errorCount++; echo "Timestamp failinng end at $baseString\n"; } // Failed round trip. $roundTrip = date("Y-m-d H:i:s", $timestamp); if ($baseString !== $roundTrip) { $errorCount++; echo "$baseString ($timestamp) $roundTrip\n"; } } } }

preferences:
41.99 ms | 402 KiB | 5 Q