3v4l.org

run code in 300+ PHP versions simultaneously
<?php function weeks_in_month($month, $year) { $dates = []; $week = 1; $date = new DateTime("$year-$month-01"); $days = (int)$date->format('t'); // total number of days in the month $oneDay = new DateInterval('P1D'); for ($day = 1; $day <= $days; $day++) { $dates["Week $week"] []= $date->format('d/m/Y'); $dayOfWeek = $date->format('l'); if ($dayOfWeek === 'Saturday') { $week++; } $date->add($oneDay); } return $dates; } print_r(weeks_in_month(1, 2018));

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.140.0150.00818.03
8.4.130.0150.00618.73
8.4.120.0110.00924.13
8.4.110.0150.00619.07
8.4.100.0120.00818.88
8.4.90.0100.00819.03
8.4.80.0080.00719.79
8.4.70.0110.00818.16
8.4.60.0090.01119.23
8.4.50.0140.00618.56
8.4.40.0130.00717.73
8.4.30.0070.01317.85
8.4.20.0040.00419.69
8.4.10.0060.00319.64
8.3.270.0110.01016.79
8.3.260.0060.00316.57
8.3.250.0040.00418.84
8.3.240.0150.00517.09
8.3.230.0120.00716.89
8.3.220.0070.01218.90
8.3.210.0100.00918.54
8.3.200.0060.00516.79
8.3.190.0100.00817.42
8.3.180.0060.00216.69
8.3.170.0070.01017.19
8.3.160.0120.00618.62
8.3.150.0060.00616.73
8.3.140.0080.00017.36
8.3.130.0070.00418.66
8.3.120.0060.00320.54
8.3.110.0080.00020.94
8.3.100.0000.00916.88
8.3.90.0040.00418.18
8.3.80.0030.00718.56
8.3.70.0210.00018.43
8.3.60.0070.00718.43
8.3.50.0110.00317.59
8.3.40.0040.01418.83
8.3.30.0100.00718.77
8.3.20.0050.00220.20
8.3.10.0080.00021.86
8.3.00.0050.00319.51
8.2.290.0140.00420.40
8.2.280.0090.01018.35
8.2.270.0130.00617.31
8.2.260.0040.00416.86
8.2.250.0060.01216.57
8.2.240.0030.00617.03
8.2.230.0090.00022.58
8.2.220.0030.00624.06
8.2.210.0030.00526.77
8.2.200.0060.00318.54
8.2.190.0100.00716.88
8.2.180.0130.00617.00
8.2.170.0040.01122.96
8.2.160.0110.00722.11
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00420.52
8.2.120.0040.00426.35
8.2.110.0000.00919.45
8.2.100.0090.00317.90
8.2.90.0100.00019.17
8.2.80.0080.00017.97
8.2.70.0040.00417.88
8.2.60.0030.00517.93
8.2.50.0090.00018.34
8.2.40.0030.00522.32
8.2.30.0040.00419.38
8.2.20.0000.00718.14
8.2.10.0040.00418.23
8.2.00.0040.00418.45
8.1.330.0100.01021.79
8.1.320.0050.00316.29
8.1.310.0050.00218.50
8.1.300.0090.00920.14
8.1.290.0090.00018.88
8.1.280.0140.00725.92
8.1.270.0030.00620.12
8.1.260.0000.00826.35
8.1.250.0040.00428.09
8.1.240.0060.00322.20
8.1.230.0060.00617.89
8.1.220.0090.00017.77
8.1.210.0000.00818.77
8.1.200.0000.01017.48
8.1.190.0080.00017.35
8.1.180.0040.00418.10
8.1.170.0050.00318.76
8.1.160.0020.00518.90
8.1.150.0000.00818.91
8.1.140.0000.00817.64
8.1.130.0030.00319.14
8.1.120.0030.00317.67
8.1.110.0000.00717.61
8.1.100.0040.00417.57
8.1.90.0040.00417.62
8.1.80.0000.00817.57
8.1.70.0000.00717.67
8.1.60.0040.00417.61
8.1.50.0090.00317.64
8.1.40.0000.00817.73
8.1.30.0000.00817.69
8.1.20.0080.00317.80
8.1.10.0030.00717.73
8.1.00.0060.00317.64
8.0.300.0040.00418.77
8.0.290.0050.00216.88
8.0.280.0030.00318.44
8.0.270.0040.00417.03
8.0.260.0060.00319.03
8.0.250.0000.00717.24
8.0.240.0030.00517.16
8.0.230.0040.00417.11
8.0.220.0070.00017.10
8.0.210.0000.00817.08
8.0.200.0030.00317.16
8.0.190.0040.00417.18
8.0.180.0000.00717.15
8.0.170.0080.00017.16
8.0.160.0000.00817.07
8.0.150.0040.00416.98
8.0.140.0030.00317.11
8.0.130.0030.00313.48
8.0.120.0000.00717.03
8.0.110.0050.00317.00
8.0.100.0080.00017.02
8.0.90.0040.00417.05
8.0.80.0060.01317.09
8.0.70.0000.00717.17
8.0.60.0040.00417.17
8.0.50.0080.00017.08
8.0.30.0050.01317.31
8.0.20.0130.00817.40
8.0.10.0000.00717.05
8.0.00.0080.01016.89
7.4.330.0050.00015.55
7.4.320.0000.00616.62
7.4.300.0030.00316.68
7.4.290.0000.00716.76
7.4.280.0070.00016.71
7.4.270.0070.00016.56
7.4.260.0030.00616.54
7.4.250.0000.00816.69
7.4.240.0000.00616.58
7.4.230.0000.00716.76
7.4.220.0040.00416.56
7.4.210.0030.01316.61
7.4.200.0030.00516.66
7.4.160.0080.00916.72
7.4.150.0070.01417.40
7.4.140.0060.01517.86
7.4.130.0130.01016.69
7.4.120.0120.00916.67
7.4.110.0060.01216.63
7.4.100.0100.00716.67
7.4.90.0090.00916.82
7.4.80.0130.00819.39
7.4.70.0090.00916.72
7.4.60.0080.00816.80
7.4.50.0070.01016.64
7.4.40.0090.00616.55
7.4.10.0080.00415.40
7.4.00.0060.01014.96
7.3.330.0030.00313.53
7.3.320.0000.00613.44
7.3.310.0030.00316.61
7.3.300.0030.00316.41
7.3.290.0100.00616.49
7.3.280.0120.00616.49
7.3.270.0130.00717.40
7.3.260.0130.00616.74
7.3.250.0110.00616.71
7.3.240.0080.01016.69
7.3.230.0140.00716.57
7.3.210.0030.01316.80
7.3.200.0030.01216.60
7.3.190.0000.01816.75
7.3.180.0030.01216.92
7.3.170.0090.00916.89
7.3.160.0080.00816.71
7.3.130.0070.00715.21
7.3.120.0070.01014.73
7.3.110.0060.01314.99
7.3.100.0000.01514.86
7.3.90.0090.00614.91
7.3.80.0030.01414.91
7.3.70.0100.00714.83
7.3.60.0110.00415.07
7.3.50.0090.00415.01
7.3.40.0130.00315.05
7.3.30.0030.00614.79
7.3.20.0060.00616.86
7.3.10.0080.00816.67
7.3.00.0030.00716.58
7.2.330.0100.00716.73
7.2.320.0110.00717.03
7.2.310.0060.01216.86
7.2.300.0100.00716.89
7.2.290.0090.00917.00
7.2.260.0100.00715.25
7.2.250.0110.00715.19
7.2.240.0030.01215.50
7.2.230.0060.00915.25
7.2.220.0030.00615.48
7.2.210.0070.01015.31
7.2.200.0030.00715.34
7.2.190.0060.00615.20
7.2.180.0000.00915.15
7.2.170.0070.00715.39
7.2.160.0090.00315.15
7.2.150.0000.01517.26
7.2.140.0100.00716.74
7.2.130.0060.00917.01
7.2.120.0070.01016.82
7.2.110.0040.01116.75
7.2.100.0000.01016.75
7.2.90.0030.00617.29
7.2.80.0060.01017.05
7.2.70.0100.00317.22
7.2.60.0070.00717.10
7.2.50.0070.01017.04
7.2.40.0040.01117.04
7.2.30.0110.00417.05
7.2.20.0060.01216.91
7.2.10.0150.01317.84
7.2.00.0090.01217.58
7.1.330.0060.00916.06
7.1.320.0070.00415.88
7.1.310.0080.00615.98
7.1.300.0030.00516.05
7.1.290.0040.01116.02
7.1.280.0000.01015.97
7.1.270.0030.00915.89
7.1.260.0070.01015.96
7.1.250.0040.01115.96
7.1.240.0040.01115.95
7.1.230.0030.01316.11
7.1.220.0030.00915.98
7.1.210.0060.00915.96
7.1.200.0040.00615.98
7.1.190.0000.01116.03
7.1.180.0030.01015.68
7.1.170.0060.00616.04
7.1.160.0040.00415.84
7.1.150.0030.00915.68
7.1.140.0000.01015.76
7.1.130.0570.01016.38
7.1.120.0100.01016.34
7.1.110.0100.00816.24
7.1.100.0130.01016.02
7.1.90.0130.01215.81
7.1.80.0110.00516.09
7.1.70.0080.01015.72
7.1.60.0150.01424.56
7.1.50.0170.01124.57
7.1.40.0220.00724.48
7.1.30.0240.00924.38
7.1.20.0230.00424.45
7.1.10.0130.00815.42
7.1.00.0130.00715.40
7.0.330.0040.01115.49
7.0.320.0060.00615.59
7.0.310.0030.01015.44
7.0.300.0040.01515.59
7.0.290.0070.00715.56
7.0.280.0000.01415.46
7.0.270.0030.00715.69
7.0.260.0030.01215.32
7.0.250.0030.00615.66
7.0.240.0100.00315.62
7.0.230.0130.00315.69
7.0.220.0080.00815.73
7.0.210.0060.00915.61
7.0.200.0000.01415.61
7.0.190.0060.00915.44
7.0.180.0000.01115.66
7.0.170.0060.00315.68
7.0.160.0060.00915.66
7.0.150.0110.00315.63
7.0.140.0030.00615.63
7.0.130.0030.01015.38
7.0.120.0100.00615.40
7.0.110.0000.01315.70
7.0.100.0060.01015.58
7.0.90.0070.00715.72
7.0.80.0130.00615.36
7.0.70.0030.01715.82
7.0.60.0030.01715.51
7.0.50.0060.00615.70
7.0.40.0030.00713.61
7.0.30.0110.00413.78
7.0.20.0060.00913.32
7.0.10.0030.00813.45
7.0.00.0060.00613.58
5.6.400.0000.01814.43
5.6.390.0100.00314.48
5.6.380.0100.00614.48
5.6.370.0060.00614.61
5.6.360.0060.01014.49
5.6.350.0060.00614.80
5.6.340.0000.01614.74
5.6.330.0100.00314.56
5.6.320.0060.00914.40
5.6.310.0070.01314.55
5.6.300.0000.01314.78
5.6.290.0070.00714.72
5.6.280.0000.01214.67
5.6.270.0060.00614.95
5.6.260.0070.00814.82
5.6.250.0000.01114.55
5.6.240.0070.01014.58
5.6.230.0090.00614.75
5.6.220.0040.01514.87
5.6.210.0070.00714.68
5.6.200.0030.00914.79
5.6.190.0070.01114.45
5.6.180.0060.01014.51
5.6.170.0100.00314.54
5.6.160.0030.00814.82
5.6.150.0000.01314.39
5.6.140.0050.00514.51
5.6.130.0000.01714.29
5.6.120.0030.01714.63
5.6.110.0000.01714.43
5.6.100.0110.00714.38
5.6.90.0030.01314.30
5.6.80.0110.00714.48
5.6.70.0030.01314.55
5.6.60.0140.00314.24
5.6.50.0100.00714.61
5.6.40.0140.00014.59
5.6.30.0120.00614.53
5.6.20.0030.00714.31
5.6.10.0060.00914.66
5.6.00.0120.00414.37

preferences:
139.63 ms | 403 KiB | 5 Q