3v4l.org

run code in 300+ PHP versions simultaneously
<?php \date_default_timezone_set('UTC'); $dates = ['2019-01-18', '2019-01-01', '2018-12-01', '2018-12-20', null]; $today = new \DateTimeImmutable('2019-01-01'); $yesterday = $today->modify('-1 day'); $results = []; foreach ($dates as $iDate) { $_GET['importDate'] = $iDate; $results[$iDate] = ''; if (!$start = \date_create(!empty($_GET['importDate']) ? $_GET['importDate'] : $yesterday->format('Y-m-d'))) { die('Invalid Date Supplied'); } if ($start > $today) { $results[$iDate] .= 'Dates set in the future are not permitted' . \PHP_EOL; continue; } //start at the first day of the month $start->modify('first day of this month')->setTime(0,0,0); //validate the current month to prevent future dates if ($start->format('Y-m') === $today->format('Y-m')) { $end = \date_create($yesterday->format('Y-m-d'))->setTime(23,59,59); if ($end < $start) { //yesterday was last month $end = clone $start; } } else { $end = clone $start; $end->modify('last day of this month'); } //end at midnight $end->setTime(23,59,59); $importDates = new \DatePeriod($start, new \DateInterval('P1D'), $end); foreach ($importDates as $date) { $dateImport = $date->format('Y-m-d'); $results[$iDate] .= $dateImport . \PHP_EOL; //... } } //display the results $values = array_reduce(\array_keys($results), function($carry, $item) use ($results) { if (!in_array($results[$item], $carry)) { $carry[] = $results[$item]; } return $carry; }, []); echo 'Current Date: ' . $today->format('Y-m-d') . \PHP_EOL . \PHP_EOL; foreach ($values as $info) { $dates = '"' . implode('", "', array_keys($results, $info)) . '"'; echo <<<EOL Import Dates: $dates $info EOL; }

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.4.130.0150.00718.04
8.4.120.0120.00722.45
8.4.110.0090.01120.52
8.4.100.0120.00917.69
8.4.90.0140.00818.93
8.4.80.0120.00919.65
8.4.70.0040.00518.04
8.4.60.0110.01018.75
8.4.50.0050.00418.62
8.4.40.0100.01020.39
8.4.30.0060.01317.71
8.4.20.0130.00720.69
8.4.10.0030.00618.05
8.3.260.0120.00916.77
8.3.250.0110.00918.80
8.3.240.0090.00816.77
8.3.230.0040.00516.65
8.3.220.0040.00317.22
8.3.210.0090.00616.71
8.3.200.0030.00616.78
8.3.190.0100.00916.70
8.3.180.0040.00516.69
8.3.170.0090.00919.03
8.3.160.0080.00019.36
8.3.150.0140.00718.30
8.3.140.0050.00316.73
8.3.130.0050.00316.82
8.3.120.0090.00018.82
8.3.110.0040.00420.94
8.3.100.0130.00324.06
8.3.90.0070.00326.77
8.3.80.0030.00618.55
8.3.70.0100.01016.63
8.3.60.0130.01018.20
8.3.50.0150.00518.34
8.3.40.0160.00019.08
8.3.30.0150.00018.82
8.3.20.0000.00720.90
8.3.10.0000.00821.61
8.3.00.0040.00423.65
8.2.290.0110.00820.51
8.2.280.0090.01020.63
8.2.270.0080.00019.16
8.2.260.0090.00018.48
8.2.250.0090.00917.05
8.2.240.0000.00917.21
8.2.230.0070.01022.58
8.2.220.0050.00337.54
8.2.210.0080.00026.77
8.2.200.0040.00718.41
8.2.190.0110.00718.18
8.2.180.0160.00916.88
8.2.170.0000.01522.96
8.2.160.0100.00320.42
8.2.150.0030.00624.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0050.00319.89
8.2.110.0040.00722.23
8.2.100.0030.00918.16
8.2.90.0050.00318.08
8.2.80.0060.00318.28
8.2.70.0000.00917.75
8.2.60.0000.00817.88
8.2.50.0090.00017.93
8.2.40.0030.00519.60
8.2.30.0030.00617.87
8.2.20.0040.00418.36
8.2.10.0080.00019.50
8.2.00.0000.00818.47
8.1.330.0100.00922.05
8.1.320.0110.01016.29
8.1.310.0140.00318.43
8.1.300.0000.01919.78
8.1.290.0060.00318.88
8.1.280.0040.01125.92
8.1.270.0040.00424.66
8.1.260.0030.00626.35
8.1.250.0040.01428.09
8.1.240.0060.00323.96
8.1.230.0120.00021.04
8.1.220.0000.00917.80
8.1.210.0110.00018.90
8.1.200.0060.00617.23
8.1.190.0030.00617.47
8.1.180.0000.00818.10
8.1.170.0050.00319.09
8.1.160.0080.00018.98
8.1.150.0050.00219.04
8.1.140.0040.00418.94
8.1.130.0000.00720.25
8.1.120.0040.00417.67
8.1.110.0040.00417.70
8.1.100.0030.00617.61
8.1.90.0080.00017.70
8.1.80.0050.00317.56
8.1.70.0040.00417.59
8.1.60.0000.00817.81
8.1.50.0040.00417.59
8.1.40.0080.00017.73
8.1.30.0000.00817.77
8.1.20.0090.00017.67
8.1.10.0000.00817.66
8.1.00.0040.00417.72
8.0.300.0060.00320.02
8.0.290.0040.00417.00
8.0.280.0050.00318.36
8.0.270.0080.00018.18
8.0.260.0000.00718.56
8.0.250.0000.00717.31
8.0.240.0030.00317.27
8.0.230.0000.00817.24
8.0.220.0070.00317.20
8.0.210.0030.00617.07
8.0.200.0050.00217.19
8.0.190.0040.00417.30
8.0.180.0050.00317.16
8.0.170.0040.00417.09
8.0.160.0020.00517.09
8.0.150.0050.00217.02
8.0.140.0000.00717.17
8.0.130.0060.00313.63
8.0.120.0040.00417.21
8.0.110.0040.00417.11
8.0.100.0030.00516.98
8.0.90.0040.00417.07
8.0.80.0150.00417.16
8.0.70.0040.00417.07
8.0.60.0000.00717.12
8.0.50.0080.00017.07
8.0.30.0070.01217.29
8.0.20.0130.01017.60
8.0.10.0040.00417.21
8.0.00.0130.00717.13
7.4.330.0000.00515.55
7.4.320.0040.00416.68
7.4.300.0050.00216.82
7.4.290.0030.00316.78
7.4.280.0030.00616.77
7.4.270.0080.00016.60
7.4.260.0000.00716.56
7.4.250.0070.00016.63
7.4.240.0000.00716.70
7.4.230.0000.00716.63
7.4.220.0000.00816.58
7.4.210.0060.00916.62
7.4.200.0000.00816.78
7.4.160.0080.00816.76
7.4.140.0100.01417.86
7.4.130.0180.00316.92
7.4.120.0080.01116.79
7.4.110.0090.00916.82
7.4.100.0110.00716.75
7.4.90.0070.01416.74
7.4.80.0110.01119.39
7.4.70.0070.01016.92
7.4.60.0040.01216.51
7.4.50.0090.00616.78
7.4.40.0070.01016.61
7.4.00.0030.01014.84
7.3.330.0050.00013.62
7.3.320.0000.00613.67
7.3.310.0000.00716.72
7.3.300.0000.00716.66
7.3.290.0030.00316.67
7.3.280.0100.00916.65
7.3.260.0100.00916.79
7.3.240.0110.01016.72
7.3.230.0070.01116.68
7.3.210.0100.00716.74
7.3.200.0140.00916.71
7.3.190.0100.01316.77
7.3.180.0060.01016.69
7.3.170.0180.00016.76
7.3.160.0070.01016.68
7.3.10.0490.00914.97
7.3.00.0410.01014.73
7.2.330.0070.01116.69
7.2.320.0040.01316.83
7.2.310.0060.01216.73
7.2.300.0060.01216.99
7.2.290.0150.00316.63
7.2.130.0520.00515.29
7.2.120.0680.00315.22
7.2.110.0640.00315.14
7.2.100.0410.01015.09
7.2.90.0420.00315.04
7.2.80.0920.00714.88
7.2.70.0380.01015.05
7.2.60.0350.00614.77
7.2.50.0720.01115.01
7.2.40.0520.00614.86
7.2.30.0440.00314.83
7.2.20.0540.00415.02
7.2.10.0550.00915.02
7.2.00.0550.00315.26
7.1.250.0390.00713.89

preferences:
30.78 ms | 403 KiB | 5 Q