3v4l.org

run code in 300+ PHP versions simultaneously
<?php function getDates(DateTime $date) { if ($date->format('d') == 20) { $nextMonth = clone $date; $nextMonth->modify('-1 day'); $nextMonth->modify('+1 month'); return [ 'start' => $date, 'end' => $nextMonth, ]; } else if ($date->format('d') == 19) { $lastMonth = clone $date; $lastMonth->modify('+1 day'); $lastMonth->modify('-1 month'); return [ 'start' => $lastMonth, 'end' => $date, ]; } } $date = new DateTime('2017-09-20'); var_dump(getDates($date)); $date = new DateTime('2017-09-19'); var_dump(getDates($date));

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.3.60.0100.01716.75
8.3.50.0040.01118.38
8.3.40.0150.00018.96
8.3.30.0090.00918.60
8.3.20.0000.00820.15
8.3.10.0000.00820.10
8.3.00.0000.00823.57
8.2.180.0130.01017.00
8.2.170.0100.01019.04
8.2.160.0000.01520.52
8.2.150.0120.00324.18
8.2.140.0080.00024.66
8.2.130.0050.00319.27
8.2.120.0080.00026.35
8.2.110.0050.00521.02
8.2.100.0090.00318.03
8.2.90.0050.00318.28
8.2.80.0040.00419.27
8.2.70.0060.00318.05
8.2.60.0000.00918.34
8.2.50.0030.00618.10
8.2.40.0030.00620.59
8.2.30.0000.00819.34
8.2.20.0000.00818.14
8.2.10.0050.00318.33
8.2.00.0100.00018.30
8.1.280.0140.00725.92
8.1.270.0090.00624.04
8.1.260.0070.00026.35
8.1.250.0070.00028.09
8.1.240.0030.00619.78
8.1.230.0110.00021.04
8.1.220.0040.00417.91
8.1.210.0030.00618.85
8.1.200.0060.00317.50
8.1.190.0050.00317.38
8.1.180.0040.00418.10
8.1.170.0040.00418.97
8.1.160.0070.00018.94
8.1.150.0000.00820.32
8.1.140.0060.00319.73
8.1.130.0000.00718.95
8.1.120.0070.00017.77
8.1.110.0030.00617.74
8.1.100.0000.00817.65
8.1.90.0020.00517.77
8.1.80.0000.00917.60
8.1.70.0070.00017.73
8.1.60.0050.00317.79
8.1.50.0030.00617.73
8.1.40.0000.00917.73
8.1.30.0080.00017.87
8.1.20.0040.00417.89
8.1.10.0000.00817.73
8.1.00.0040.00417.77
8.0.300.0000.00720.21
8.0.290.0040.00417.00
8.0.280.0040.00418.64
8.0.270.0000.00717.41
8.0.260.0030.00318.59
8.0.250.0070.00017.21
8.0.240.0060.00317.24
8.0.230.0000.00717.19
8.0.220.0030.00317.21
8.0.210.0000.00717.14
8.0.200.0030.00317.33
8.0.190.0060.00317.21
8.0.180.0000.00817.27
8.0.170.0040.00417.23
8.0.160.0020.00517.21
8.0.150.0030.00617.13
8.0.140.0030.00617.07
8.0.130.0040.00413.55
8.0.120.0040.00417.13
8.0.110.0050.00217.12
8.0.100.0000.00717.25
8.0.90.0050.00317.07
8.0.80.0040.01217.17
8.0.70.0040.00417.09
8.0.60.0000.00817.11
8.0.50.0090.00017.13
8.0.30.0100.01017.40
8.0.20.0110.01217.42
8.0.10.0080.00017.21
8.0.00.0100.00917.16
7.4.330.0030.00315.55
7.4.320.0040.00416.75
7.4.300.0000.00616.68
7.4.290.0000.00816.80
7.4.280.0040.00416.85
7.4.270.0070.00016.72
7.4.260.0030.00316.67
7.4.250.0040.00416.62
7.4.240.0040.00416.72
7.4.230.0070.00016.91
7.4.220.0110.00716.66
7.4.210.0100.00316.87
7.4.200.0040.00416.92
7.4.160.0160.00916.84
7.4.150.0170.00317.40
7.4.140.0120.00817.86
7.4.130.0200.00016.76
7.4.120.0090.01116.69
7.4.110.0120.00616.74
7.4.100.0150.00316.71
7.4.90.0120.00616.79
7.4.80.0090.00919.39
7.4.70.0110.00816.59
7.4.60.0130.00316.80
7.4.50.0070.00216.77
7.4.40.0110.00716.76
7.4.30.0070.01016.79
7.4.00.0070.00915.13
7.3.330.0030.00313.41
7.3.320.0020.00313.39
7.3.310.0000.00716.59
7.3.300.0030.00316.59
7.3.290.0000.00716.58
7.3.280.0080.01016.56
7.3.270.0080.00817.40
7.3.260.0110.01016.78
7.3.250.0140.00616.44
7.3.240.0120.00816.64
7.3.230.0070.01116.85
7.3.210.0150.00316.90
7.3.200.0120.00916.85
7.3.190.0060.00916.73
7.3.180.0090.00916.62
7.3.170.0060.01616.63
7.3.160.0070.01116.74
7.3.120.0100.00815.08
7.3.110.0090.00915.23
7.3.100.0100.00814.90
7.3.90.0110.00515.17
7.3.80.0080.01015.13
7.3.70.0070.00714.99
7.3.60.0120.00515.04
7.3.50.0080.00515.19
7.3.40.0060.00814.99
7.3.30.0060.01015.02
7.3.20.0040.01116.83
7.3.10.0050.01016.78
7.3.00.0090.00716.98
7.2.330.0150.00416.89
7.2.320.0170.00716.97
7.2.310.0170.00316.75
7.2.300.0060.01216.89
7.2.290.0110.00816.91
7.2.250.0050.01315.06
7.2.240.0110.00815.08
7.2.230.0070.00915.19
7.2.220.0080.00815.11
7.2.210.0080.00815.12
7.2.200.0060.00915.12
7.2.190.0050.01315.17
7.2.180.0080.00815.27
7.2.170.0030.00715.01
7.2.60.0040.00716.96
7.1.330.0070.00716.04
7.1.320.0040.01216.02
7.1.310.0100.00515.87
7.1.300.0080.00716.08
7.1.290.0060.00615.86
7.1.280.0080.00715.77
7.1.270.0070.00716.05
7.1.260.0050.00915.86
7.1.200.0070.00716.01
7.1.90.0060.00918.34
7.1.80.0060.00918.45
7.1.70.0060.00617.53
7.1.60.0210.00935.35
7.1.50.0170.02134.96
7.1.40.0280.01234.59
7.1.30.0130.02634.86
7.1.20.0120.02234.63
7.1.10.0000.01316.83
7.1.00.0000.01316.96
7.0.230.0030.01018.15
7.0.220.0100.00317.98
7.0.210.0060.00816.59
7.0.200.0040.01217.04
7.0.190.0030.01816.76
7.0.180.0000.02116.63
7.0.170.0090.00916.45
7.0.160.0030.01216.48
7.0.150.0080.00616.50
7.0.140.0000.01216.53
7.0.130.0060.00616.70
7.0.120.0090.00316.55
7.0.110.0090.00316.23
7.0.100.0030.01016.53
7.0.90.0030.01316.64
7.0.80.0080.00816.63
7.0.70.0050.00816.51
7.0.60.0000.01316.27
7.0.50.0060.00616.36
7.0.40.0000.01416.36
7.0.30.0040.01116.67
7.0.20.0080.00516.30
7.0.10.0000.01316.67
7.0.00.0090.00516.54

preferences:
33.88 ms | 400 KiB | 5 Q