3v4l.org

run code in 300+ PHP versions simultaneously
<?php function weekCounter($startDate,$endDate){ //calculate # of full weeks between dates $secsPerWeek = 60 * 60 * 24 * 7; $fullWeeks = floor((strtotime($endDate) - strtotime($startDate))/$secsPerWeek); $fullMonths = floor($fullWeeks/4); $weeksRemainder = $fullWeeks % 4; // weeks that don't fit in a month return "Months: $fullMonths, Weeks: $weeksRemainder"; } $startDate = '2016-06-13'; $endDates = ['2016-06-20','2016-06-27','2016-07-04']; foreach($endDates as $endDate) echo weekCounter($startDate,$endDate)."\n";

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.0040.01118.43
8.3.50.0140.00719.71
8.3.40.0000.01519.14
8.3.30.0150.00018.70
8.3.20.0000.00720.21
8.3.10.0040.00421.90
8.3.00.0040.00419.79
8.2.180.0110.00718.38
8.2.170.0030.01422.96
8.2.160.0070.00721.25
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0000.00722.38
8.2.120.0080.00026.35
8.2.110.0000.00920.70
8.2.100.0060.00617.84
8.2.90.0000.00819.30
8.2.80.0040.00417.97
8.2.70.0060.00317.88
8.2.60.0050.00318.16
8.2.50.0030.00918.07
8.2.40.0040.00419.91
8.2.30.0040.00418.09
8.2.20.0040.00417.91
8.2.10.0000.00718.22
8.2.00.0030.00618.13
8.1.280.0090.00625.92
8.1.270.0050.00323.95
8.1.260.0080.00028.09
8.1.250.0040.00428.09
8.1.240.0090.00022.64
8.1.230.0000.01122.78
8.1.220.0060.00317.91
8.1.210.0030.00518.77
8.1.200.0040.00417.60
8.1.190.0040.00417.47
8.1.180.0090.00018.10
8.1.170.0050.00318.66
8.1.160.0050.00319.05
8.1.150.0000.00718.92
8.1.140.0040.00419.70
8.1.130.0030.00317.81
8.1.120.0020.00517.71
8.1.110.0030.00617.70
8.1.100.0040.00417.69
8.1.90.0060.00317.67
8.1.80.0000.00717.70
8.1.70.0020.00517.59
8.1.60.0070.00017.80
8.1.50.0060.00317.72
8.1.40.0040.00417.65
8.1.30.0060.00317.83
8.1.20.0080.00017.74
8.1.10.0000.00817.65
8.1.00.0000.00817.72
8.0.300.0000.00718.77
8.0.290.0000.00917.00
8.0.280.0070.00018.45
8.0.270.0000.00717.26
8.0.260.0000.00717.41
8.0.250.0000.00717.24
8.0.240.0000.01017.13
8.0.230.0040.00417.17
8.0.220.0040.00417.13
8.0.210.0000.00717.12
8.0.200.0030.00317.27
8.0.190.0040.00417.21
8.0.180.0040.00417.08
8.0.170.0000.00717.19
8.0.160.0040.00417.22
8.0.150.0040.00417.00
8.0.140.0040.00317.12
8.0.130.0030.00313.54
8.0.120.0060.00317.17
8.0.110.0050.00317.00
8.0.100.0070.00017.05
8.0.90.0040.00417.02
8.0.80.0060.01717.18
8.0.70.0040.00417.05
8.0.60.0040.00417.13
8.0.50.0040.00417.00
8.0.30.0050.01317.49
8.0.20.0140.00617.41
8.0.10.0030.00517.29
8.0.00.0060.01216.96
7.4.330.0050.00015.09
7.4.320.0000.00716.69
7.4.300.0000.00616.80
7.4.290.0000.00716.69
7.4.280.0060.00316.79
7.4.270.0030.00316.78
7.4.260.0000.00716.71
7.4.250.0070.00016.66
7.4.240.0030.00516.84
7.4.230.0070.00016.63
7.4.220.0100.01716.86
7.4.210.0080.00816.72
7.4.200.0070.00016.89
7.4.160.0060.01116.71
7.4.150.0090.00917.40
7.4.140.0130.00517.86
7.4.130.0100.00716.90
7.4.120.0060.01016.65
7.4.110.0100.01016.85
7.4.100.0110.00716.70
7.4.90.0070.01016.84
7.4.80.0120.00919.39
7.4.70.0130.00416.71
7.4.60.0070.00816.69
7.4.50.0000.01616.63
7.4.40.0160.00716.63
7.4.30.0030.01416.97
7.4.00.0100.00715.05
7.3.330.0060.00013.53
7.3.320.0020.00313.54
7.3.310.0040.00416.54
7.3.300.0100.00016.59
7.3.290.0030.00316.53
7.3.280.0120.00616.52
7.3.270.0100.01017.40
7.3.260.0130.00516.66
7.3.250.0160.00316.64
7.3.240.0050.01216.70
7.3.230.0100.01316.69
7.3.210.0110.00616.62
7.3.200.0060.01016.71
7.3.190.0090.00916.80
7.3.180.0080.00516.59
7.3.170.0080.01116.64
7.3.160.0040.01916.78
7.3.120.0040.01214.96
7.3.110.0070.00714.52
7.3.100.0040.00815.03
7.3.90.0070.00314.92
7.3.80.0100.00614.98
7.3.70.0070.00715.00
7.3.60.0060.00315.08
7.3.50.0060.00615.11
7.3.40.0070.00714.91
7.3.30.0080.00315.02
7.3.20.0030.01016.79
7.3.10.0130.00616.62
7.3.00.0080.01016.33
7.2.330.0120.00616.98
7.2.320.0060.01016.84
7.2.310.0170.00016.93
7.2.300.0160.00916.82
7.2.290.0070.01016.83
7.2.240.0090.00615.07
7.2.230.0060.00615.03
7.2.220.0130.00315.08
7.2.210.0040.00814.97
7.2.200.0070.01015.21
7.2.190.0000.01315.15
7.2.180.0060.01014.93
7.2.170.0060.00715.28
7.2.160.0080.00615.06
7.2.150.0110.00417.21
7.2.140.0070.00316.78
7.2.130.0090.01016.72
7.2.120.0100.00516.82
7.2.110.0140.00516.78
7.2.100.0050.01317.02
7.2.90.0120.00916.77
7.2.80.0150.00516.93
7.2.70.0110.01016.97
7.2.60.0070.01017.01
7.2.50.0070.01116.99
7.2.40.0130.01016.90
7.2.30.0100.00817.05
7.2.20.0110.00917.00
7.2.10.0100.00617.11
7.2.00.0060.01117.74
7.1.330.0060.00315.64
7.1.320.0000.00916.08
7.1.310.0030.00715.96
7.1.300.0040.01216.04
7.1.290.0090.00416.12
7.1.280.0090.00615.70
7.1.270.0030.01115.84
7.1.260.0000.01516.05
7.1.250.0110.00915.80
7.1.200.0100.00316.05
7.1.100.0000.01418.52
7.1.70.0040.00717.38
7.1.60.0030.00719.75
7.1.00.0000.08022.51
7.0.200.0030.00516.98
7.0.90.1400.06720.21
7.0.80.0200.05720.01
7.0.70.0270.07020.10
7.0.60.0130.06319.97
7.0.50.0200.06020.39
7.0.40.0070.07020.46
7.0.30.0200.05720.46
7.0.20.0130.06320.40
7.0.10.0000.07020.35
7.0.00.0130.06020.39
5.6.240.0170.06720.76
5.6.230.0200.05320.61
5.6.220.0030.06720.74
5.6.210.0070.07320.75
5.6.200.0100.07021.09
5.6.190.0100.06721.14
5.6.180.0130.05721.21
5.6.170.0230.05321.05
5.6.160.0030.06321.09
5.6.150.0100.05721.09
5.6.140.0100.06321.06
5.6.130.0130.05721.07
5.6.120.0200.05321.08
5.6.110.0170.05321.07
5.6.100.0100.07721.13
5.6.90.0170.05321.06
5.6.80.0170.04720.43
5.6.70.0130.05020.46
5.6.60.0070.05720.49
5.6.50.0070.06320.48
5.6.40.0100.05320.37
5.6.30.0100.05320.45
5.6.20.0100.07320.44
5.6.10.0100.05320.52
5.6.00.0100.06020.52

preferences:
57.72 ms | 400 KiB | 5 Q