3v4l.org

run code in 300+ PHP versions simultaneously
<?php function percentYear($a, $b) { //Takes in two dates and returns the decimal of days per year for that specific year // I made this in order to fix the issue of leap years. if(strtotime($a)<strtotime($b)){ list($a, $b) = array($b, $a); } $aYearDay = date("z", strtotime($a)) + 1; $aYearDays = date("z", strtotime(date("Y", strtotime($a))."-12-31")) + 1; $aPercent = $aYearDay/$aYearDays; $bYearDay = date("z", strtotime($b)) + 1; $bYearDays = date("z", strtotime(date("Y", strtotime($b))."-12-31")) + 1; $bPercent = $bYearDay/$bYearDays; if(date("Y", strtotime($a))!=date("Y", strtotime($b))) { $aPercent += abs(date("Y", strtotime($a))-date("Y", strtotime($b))); } return abs($aPercent-$bPercent); } var_dump( percentYear("2013-02-04", "2012-02-04"))*365; var_dump( percentYear("2011-02-04", "2010-02-04"));

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.0090.00618.80
8.3.50.0080.00821.09
8.3.40.0000.01519.04
8.3.30.0060.01019.08
8.3.20.0040.00420.09
8.3.10.0000.00821.88
8.3.00.0140.00322.32
8.2.180.0150.00016.88
8.2.170.0070.00722.96
8.2.160.0070.00719.28
8.2.150.0050.00324.18
8.2.140.0040.00424.66
8.2.130.0120.00626.16
8.2.120.0110.00017.75
8.2.110.0030.00620.38
8.2.100.0090.00318.09
8.2.90.0040.00419.41
8.2.80.0030.00618.00
8.2.70.0060.00317.88
8.2.60.0040.00418.05
8.2.50.0000.00818.07
8.2.40.0000.00818.28
8.2.30.0000.00818.28
8.2.20.0000.00817.91
8.2.10.0030.00617.93
8.2.00.0040.00717.95
8.1.280.0080.00825.92
8.1.270.0100.00618.83
8.1.260.0090.00026.35
8.1.250.0080.00028.09
8.1.240.0030.00621.17
8.1.230.0040.00717.76
8.1.220.0000.00817.77
8.1.210.0050.00318.77
8.1.200.0060.00317.61
8.1.190.0060.00317.53
8.1.180.0040.00418.71
8.1.170.0070.00418.68
8.1.160.0070.00022.16
8.1.150.0020.00518.80
8.1.140.0000.00717.66
8.1.130.0070.00017.84
8.1.120.0030.00517.64
8.1.110.0000.00817.52
8.1.100.0000.00817.66
8.1.90.0040.00417.56
8.1.80.0000.00717.63
8.1.70.0030.00317.63
8.1.60.0000.00917.76
8.1.50.0070.00017.54
8.1.40.0000.00817.61
8.1.30.0040.00417.84
8.1.20.0030.00617.71
8.1.10.0000.00917.58
8.1.00.0050.00317.66
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0040.00418.46
8.0.270.0050.00217.39
8.0.260.0030.00317.12
8.0.250.0000.00717.16
8.0.240.0030.00717.23
8.0.230.0040.00417.20
8.0.220.0030.00317.16
8.0.210.0000.00717.18
8.0.200.0030.00517.23
8.0.190.0000.00817.23
8.0.180.0040.00417.14
8.0.170.0000.00817.23
8.0.160.0000.00817.20
8.0.150.0040.00417.04
8.0.140.0030.00617.14
8.0.130.0000.00613.54
8.0.120.0050.00317.04
8.0.110.0050.00217.19
8.0.100.0040.00417.06
8.0.90.0000.00717.28
8.0.80.0160.00317.17
8.0.70.0000.00816.98
8.0.60.0040.00417.11
8.0.50.0070.00016.94
8.0.30.0080.01017.34
8.0.20.0140.00717.50
8.0.10.0000.00817.18
8.0.00.0070.01517.14
7.4.330.0000.00515.00
7.4.320.0000.00716.71
7.4.300.0060.00016.71
7.4.290.0040.00416.75
7.4.280.0040.00416.66
7.4.270.0000.00716.77
7.4.260.0040.00416.59
7.4.250.0000.00716.77
7.4.240.0000.00716.72
7.4.230.0040.00416.84
7.4.220.0130.00616.79
7.4.210.0060.00916.72
7.4.200.0030.00316.69
7.4.190.0030.00416.86
7.4.160.0090.00616.55
7.4.150.0150.00317.40
7.4.140.0070.01317.86
7.4.130.0050.01216.76
7.4.120.0050.01316.65
7.4.110.0120.00616.54
7.4.100.0130.00716.65
7.4.90.0070.01116.82
7.4.80.0030.01519.39
7.4.70.0030.01416.72
7.4.60.0110.00516.90
7.4.50.0080.00016.74
7.4.40.0100.00622.77
7.4.30.0080.00816.65
7.4.00.0030.01015.10
7.3.330.0060.00013.43
7.3.320.0020.00513.43
7.3.310.0030.00316.39
7.3.300.0000.00716.52
7.3.290.0100.01016.52
7.3.280.0050.00916.52
7.3.270.0140.00317.40
7.3.260.0140.00316.75
7.3.250.0050.01216.66
7.3.240.0160.00716.65
7.3.230.0070.01016.84
7.3.210.0080.00816.47
7.3.200.0030.01519.39
7.3.190.0110.01116.60
7.3.180.0130.00316.77
7.3.170.0060.00916.71
7.3.160.0090.01316.60
7.3.120.0050.01214.98
7.3.110.0140.00415.14
7.3.100.0110.00414.79
7.3.90.0030.00615.06
7.3.80.0100.00315.22
7.3.70.0040.01115.07
7.3.60.0110.00414.61
7.3.50.0000.00915.03
7.3.40.0120.00315.01
7.3.30.0060.00614.82
7.3.20.0070.00316.92
7.3.10.0040.01116.91
7.3.00.0120.00316.70
7.2.330.0140.00416.93
7.2.320.0100.01316.59
7.2.310.0090.00816.93
7.2.300.0080.01416.70
7.2.290.0060.01116.57
7.2.250.0100.00315.41
7.2.240.0000.02015.32
7.2.230.0110.00715.04
7.2.220.0030.00615.03
7.2.210.0060.00614.82
7.2.200.0090.00615.08
7.2.190.0110.00715.10
7.2.180.0060.00915.18
7.2.170.0060.00615.15
7.2.00.0060.00919.55
7.1.330.0080.00815.83
7.1.320.0050.00316.00
7.1.310.0000.00915.58
7.1.300.0070.00715.77
7.1.290.0100.00315.94
7.1.280.0070.00715.70
7.1.270.0090.00916.05
7.1.260.0030.00615.75
7.1.100.0060.00918.34
7.1.70.0020.00517.25
7.1.60.0130.01019.82
7.1.50.0060.01217.22
7.1.00.0070.03322.27
7.0.200.0270.00015.00
7.0.140.0070.07021.93
7.0.80.0570.03719.96
7.0.70.0530.07319.99
7.0.60.0570.07019.87
7.0.50.0500.04320.18
7.0.40.0030.05320.08
7.0.30.0100.05020.04
7.0.20.0130.06020.13
7.0.10.0130.07719.99
7.0.00.0130.07020.17
5.6.280.0000.07721.05
5.6.230.0230.07320.70
5.6.220.0170.07020.63
5.6.210.0100.08020.57
5.6.200.0170.04021.05
5.6.190.0030.08720.95
5.6.180.0170.08321.02
5.6.170.0030.04721.05
5.6.160.0030.06021.01
5.6.150.0100.03721.08
5.6.140.0130.06721.09
5.6.130.0100.04021.08
5.6.120.0100.05321.02
5.6.110.0000.05021.01
5.6.100.0100.07721.05
5.6.90.0030.08021.07
5.6.80.0070.09320.47
5.6.70.0100.04320.50
5.6.60.0100.07720.42
5.6.50.0130.07320.35
5.6.40.0100.08020.38
5.6.30.0030.07720.43
5.6.20.0070.08720.38
5.6.10.0200.07320.50
5.6.00.0070.07320.35
5.5.370.0130.05320.37
5.5.360.0000.08320.50
5.5.350.0100.08320.44
5.5.340.0170.07320.89
5.5.330.0130.08020.85
5.5.320.0100.07720.92
5.5.310.0100.07720.88
5.5.300.0170.08720.91
5.5.290.0030.05020.93
5.5.280.0130.03720.89
5.5.270.0070.05720.73
5.5.260.0030.05320.76
5.5.250.0100.04020.61
5.5.240.0100.07720.31
5.5.230.0000.07720.30
5.5.220.0100.05020.14
5.5.210.0070.08320.03
5.5.200.0230.05319.99
5.5.190.0070.08320.19
5.5.180.0030.07720.13
5.5.160.0170.07020.28
5.5.150.0000.07720.09
5.5.140.0100.07720.25
5.5.130.0100.06320.15
5.5.120.0030.05020.27
5.5.110.0030.08720.27
5.5.100.0130.07320.07
5.5.90.0100.07020.05
5.5.80.0070.07720.09
5.5.70.0000.04320.16
5.5.60.0170.06020.05
5.5.50.0170.06320.16
5.5.40.0100.07720.01
5.5.30.0130.06320.16
5.5.20.0000.08720.16
5.5.10.0000.05320.04
5.5.00.0130.07720.04
5.4.450.0070.08319.18
5.4.440.0030.04319.37
5.4.430.0070.06719.48
5.4.420.0070.04019.53
5.4.410.0070.08719.32
5.4.400.0100.07719.13
5.4.390.0030.04319.03
5.4.380.0070.08019.23
5.4.370.0130.04318.95
5.4.360.0070.07319.18
5.4.350.0030.05719.21
5.4.340.0070.08318.94
5.4.320.0130.06719.21
5.4.310.0070.07318.90
5.4.300.0100.06019.21
5.4.290.0070.07718.95
5.4.280.0100.07319.15
5.4.270.0100.07719.04
5.4.260.0100.07719.12
5.4.250.0030.05719.04
5.4.240.0070.04019.12
5.4.230.0070.04719.02
5.4.220.0130.07719.15
5.4.210.0130.07319.09
5.4.200.0170.07718.84
5.4.190.0130.06719.04
5.4.180.0030.04719.16
5.4.170.0070.03719.07
5.4.160.0070.07719.14
5.4.150.0070.08019.10
5.4.140.0030.08016.40
5.4.130.0030.04716.48
5.4.120.0000.04316.24
5.4.110.0130.07016.56
5.4.100.0100.07016.47
5.4.90.0030.06016.45
5.4.80.0100.04716.36
5.4.70.0170.06316.30
5.4.60.0070.05016.41
5.4.50.0070.07716.31
5.4.40.0000.05316.45
5.4.30.0130.06716.48
5.4.20.0030.07316.47
5.4.10.0100.06016.25
5.4.00.0100.05015.87
5.3.290.0100.07314.64
5.3.280.0030.07014.62
5.3.270.0070.07014.64
5.3.260.0000.08314.59
5.3.250.0000.07714.68
5.3.240.0030.07314.76
5.3.230.0030.04014.56
5.3.220.0070.06314.70
5.3.210.0030.06314.50
5.3.200.0030.07314.51
5.3.190.0000.09314.56
5.3.180.0100.07314.64
5.3.170.0200.06714.50
5.3.160.0070.08014.50
5.3.150.0100.07714.53
5.3.140.0130.07014.66
5.3.130.0030.08014.58
5.3.120.0030.04714.52
5.3.110.0170.07014.58
5.3.100.0030.07313.98
5.3.90.0070.07014.04
5.3.80.0070.06714.15
5.3.70.0000.05314.00
5.3.60.0070.06714.13
5.3.50.0030.07314.10
5.3.40.0130.06313.94
5.3.30.0030.06313.82
5.3.20.0130.06713.69
5.3.10.0030.07313.66
5.3.00.0100.05013.79
5.2.170.0000.07011.22
5.2.160.0070.05311.14
5.2.150.0030.07011.17
5.2.140.0030.03711.15
5.2.130.0030.05311.21
5.2.120.0000.06010.98
5.2.110.0100.05311.21
5.2.100.0030.05011.03
5.2.90.0030.06311.15
5.2.80.0030.04711.06
5.2.70.0100.06011.24
5.2.60.0070.05710.96
5.2.50.0030.05310.95
5.2.40.0130.05010.90
5.2.30.0030.05711.07
5.2.20.0030.06711.09
5.2.10.0030.04710.79
5.2.00.0000.05710.74
5.1.60.0130.04710.03
5.1.50.0100.05010.13
5.1.40.0030.05310.09
5.1.30.0030.05310.39
5.1.20.0130.03010.49
5.1.10.0070.05010.03
5.1.00.0100.05310.23
5.0.50.0030.0508.55
5.0.40.0030.0278.55
5.0.30.0000.0538.14
5.0.20.0000.0508.32
5.0.10.0030.0408.31
5.0.00.0030.0338.29
4.4.90.0030.0377.31
4.4.80.0000.0377.31
4.4.70.0030.0307.31
4.4.60.0030.0307.31
4.4.50.0000.0377.31
4.4.40.0030.0477.31
4.4.30.0000.0377.31
4.4.20.0030.0277.31
4.4.10.0030.0377.31
4.4.00.0030.0507.31
4.3.110.0070.0307.31
4.3.100.0030.0337.31
4.3.90.0000.0377.31
4.3.80.0000.0277.31
4.3.70.0000.0337.31
4.3.60.0070.0337.31
4.3.50.0030.0277.31
4.3.40.0030.0507.31
4.3.30.0000.0377.31
4.3.20.0000.0377.31
4.3.10.0030.0307.31
4.3.00.0000.0307.31

preferences:
41.95 ms | 401 KiB | 5 Q