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")); 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.0150.00018.66
8.3.50.0130.00721.33
8.3.40.0070.00718.93
8.3.30.0140.00419.25
8.3.20.0000.00720.34
8.3.10.0060.00322.13
8.3.00.0050.00322.58
8.2.180.0110.00416.75
8.2.170.0040.01122.96
8.2.160.0070.00719.34
8.2.150.0050.00324.18
8.2.140.0050.00324.66
8.2.130.0000.00826.16
8.2.120.0080.00019.48
8.2.110.0180.00422.12
8.2.100.0040.00820.52
8.2.90.0000.00819.17
8.2.80.0040.00418.00
8.2.70.0000.00917.75
8.2.60.0060.00717.92
8.2.50.0000.00818.07
8.2.40.0050.00321.06
8.2.30.0080.00018.38
8.2.20.0050.00318.10
8.2.10.0050.00218.02
8.2.00.0030.00718.07
8.1.280.0180.00325.92
8.1.270.0030.00522.13
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0040.00422.13
8.1.230.0070.00419.08
8.1.220.0080.00017.79
8.1.210.0040.00418.77
8.1.200.0030.00717.48
8.1.190.0040.00417.35
8.1.180.0100.00318.10
8.1.170.0030.00618.71
8.1.160.0000.00822.02
8.1.150.0040.00418.81
8.1.140.0080.00017.66
8.1.130.0030.00317.90
8.1.120.0000.00817.61
8.1.110.0050.00317.67
8.1.100.0040.00417.67
8.1.90.0040.00417.62
8.1.80.0000.00717.68
8.1.70.0000.00717.65
8.1.60.0060.00317.72
8.1.50.0080.00017.65
8.1.40.0040.00417.65
8.1.30.0000.00717.84
8.1.20.0040.00417.70
8.1.10.0030.00617.69
8.1.00.0030.00617.70
8.0.300.0040.00418.77
8.0.290.0040.00417.00
8.0.280.0070.00018.55
8.0.270.0000.00817.01
8.0.260.0030.00317.11
8.0.250.0000.00717.22
8.0.240.0000.01017.17
8.0.230.0000.00717.28
8.0.220.0070.00017.05
8.0.210.0000.00817.17
8.0.200.0030.00317.30
8.0.190.0060.00317.12
8.0.180.0040.00417.19
8.0.170.0030.00517.11
8.0.160.0000.00717.16
8.0.150.0040.00416.98
8.0.140.0060.00317.03
8.0.130.0000.00613.55
8.0.120.0050.00217.13
8.0.110.0030.00517.11
8.0.100.0030.00417.24
8.0.90.0070.00017.18
8.0.80.0070.01017.13
8.0.70.0030.00517.09
8.0.60.0040.00417.23
8.0.50.0050.00317.00
8.0.30.0090.00917.20
8.0.20.0090.01017.42
8.0.10.0050.00317.16
8.0.00.0090.00916.96
7.4.330.0000.00515.00
7.4.320.0000.00616.52
7.4.300.0060.00016.69
7.4.290.0040.00416.76
7.4.280.0000.00716.70
7.4.270.0070.00016.59
7.4.260.0000.00716.66
7.4.250.0030.00616.73
7.4.240.0040.00316.67
7.4.230.0030.00316.72
7.4.220.0100.01616.68
7.4.210.0050.01216.69
7.4.200.0040.00416.50
7.4.190.0000.00716.47
7.4.160.0120.01216.72
7.4.150.0120.00617.40
7.4.140.0100.00717.86
7.4.130.0110.01116.78
7.4.120.0090.00716.70
7.4.110.0000.01616.69
7.4.100.0100.00716.73
7.4.90.0070.01416.72
7.4.80.0150.00319.39
7.4.70.0100.00716.60
7.4.60.0100.00716.63
7.4.50.0000.00816.78
7.4.40.0060.00322.77
7.4.30.0060.00916.54
7.4.10.0070.01115.25
7.4.00.0070.00915.13
7.3.330.0030.00313.52
7.3.320.0030.00313.30
7.3.310.0040.00416.35
7.3.300.0000.00616.53
7.3.290.0030.01016.52
7.3.280.0080.00716.55
7.3.270.0120.00817.40
7.3.260.0090.01416.43
7.3.250.0100.00916.63
7.3.240.0120.00816.61
7.3.230.0070.01016.59
7.3.210.0070.01016.61
7.3.200.0080.01116.46
7.3.190.0100.00716.66
7.3.180.0070.00916.39
7.3.170.0060.00916.49
7.3.160.0070.01016.59
7.3.130.0060.01215.12
7.3.120.0110.00715.00
7.3.110.0080.01014.96
7.3.100.0060.00815.22
7.3.90.0050.00814.82
7.3.80.0030.01014.88
7.3.70.0070.00714.91
7.3.60.0050.00714.97
7.3.50.0030.00815.15
7.3.40.0070.00515.01
7.3.30.0050.00915.11
7.3.20.0050.01016.76
7.3.10.0100.00216.59
7.3.00.0080.00816.61
7.2.330.0150.00316.89
7.2.320.0030.01616.91
7.2.310.0060.01216.57
7.2.300.0120.00616.61
7.2.290.0070.01016.79
7.2.260.0060.01315.00
7.2.250.0090.00715.13
7.2.240.0040.01115.27
7.2.230.0080.00915.08
7.2.220.0030.01015.31
7.2.210.0030.00715.21
7.2.200.0050.00914.85
7.2.190.0000.01315.21
7.2.180.0060.00615.04
7.2.170.0050.01115.11
7.2.160.0000.00915.08
7.2.150.0110.00317.06
7.2.140.0070.00717.05
7.2.130.0030.01317.07
7.2.120.0070.00717.05
7.2.110.0050.00517.04
7.2.100.0070.00417.07
7.2.90.0150.00416.77
7.2.80.0060.01317.02
7.2.70.0070.00717.07
7.2.60.0060.00917.13
7.2.50.0090.00617.04
7.2.40.0060.00616.78
7.2.30.0000.01517.04
7.2.20.0000.01416.98
7.2.10.0000.01217.02
7.2.00.0020.01018.14
7.1.330.0050.00815.98
7.1.320.0040.00915.91
7.1.310.0070.00515.94
7.1.300.0010.01015.88
7.1.290.0060.00715.98
7.1.280.0030.00615.96
7.1.270.0040.00915.92
7.1.260.0080.00316.02
7.1.250.0090.00615.84
7.1.240.0030.01215.64
7.1.230.0070.00715.81
7.1.220.0040.01215.98
7.1.210.0070.01015.75
7.1.200.0000.00915.89
7.1.190.0070.00715.90
7.1.180.0030.01015.95
7.1.170.0060.00815.68
7.1.160.0030.00916.00
7.1.150.0000.01415.75
7.1.140.0070.00715.88
7.1.130.0030.01016.08
7.1.120.0060.00615.58
7.1.110.0100.00715.96
7.1.100.0060.00817.07
7.1.90.0000.01516.07
7.1.80.0030.00916.07
7.1.70.0030.00916.48
7.1.60.0130.00817.88
7.1.50.0080.01116.47
7.1.40.0080.00816.03
7.1.30.0100.00615.63
7.1.20.0080.00315.93
7.1.10.0040.01115.81
7.1.00.0110.03219.13
7.0.330.0090.00615.48
7.0.320.0120.00615.55
7.0.310.0060.00615.52
7.0.300.0060.00915.43
7.0.290.0000.00815.50
7.0.280.0100.00015.66
7.0.270.0030.00615.68
7.0.260.0040.01115.34
7.0.250.0060.00315.39
7.0.240.0070.00715.64
7.0.230.0060.01115.33
7.0.220.0030.01015.61
7.0.210.0130.00315.64
7.0.200.0080.00816.25
7.0.190.0030.00715.57
7.0.180.0100.00315.57
7.0.170.0030.00715.30
7.0.160.0000.01715.73
7.0.150.0140.00015.27
7.0.140.0050.04018.78
7.0.130.0060.00915.71
7.0.120.0110.00315.55
7.0.110.0110.00715.50
7.0.100.0050.00515.39
7.0.90.0060.00815.67
7.0.80.0150.02817.61
7.0.70.0100.02517.85
7.0.60.0170.02517.81
7.0.50.0180.02817.88
7.0.40.0040.02216.78
7.0.30.0060.04616.89
7.0.20.0050.05216.66
7.0.10.0020.03516.89
7.0.00.0060.02816.89
5.6.400.0000.00914.56
5.6.390.0000.01114.13
5.6.380.0070.00714.44
5.6.370.0100.00314.43
5.6.360.0030.01014.38
5.6.350.0030.00914.80
5.6.340.0070.01014.42
5.6.330.0030.00614.14
5.6.320.0040.00814.70
5.6.310.0030.01414.46
5.6.300.0000.01714.59
5.6.290.0000.01314.40
5.6.280.0070.03817.84
5.6.270.0000.01814.18
5.6.260.0060.00614.45
5.6.250.0030.01214.25
5.6.240.0060.00614.59
5.6.230.0100.02017.59
5.6.220.0030.02517.63
5.6.210.0060.04017.53
5.6.200.0080.02317.69
5.6.190.0050.02317.76
5.6.180.0120.03617.71
5.6.170.0130.04017.72
5.6.160.0080.03017.75
5.6.150.0150.03517.81
5.6.140.0080.03717.71
5.6.130.0070.03717.69
5.6.120.0030.02717.84
5.6.110.0070.04217.64
5.6.100.0050.04717.79
5.6.90.0070.03017.81
5.6.80.0080.03917.38
5.6.70.0020.04017.39
5.6.60.0020.05017.38
5.6.50.0080.04317.37
5.6.40.0150.03517.35
5.6.30.0030.03017.53
5.6.20.0060.03917.32
5.6.10.0060.04417.38
5.6.00.0080.03517.41
5.5.380.0090.00014.45
5.5.370.0030.03817.41
5.5.360.0030.02317.44
5.5.350.0040.03117.28
5.5.340.0080.02717.60
5.5.330.0060.03017.71
5.5.320.0020.02517.72
5.5.310.0080.02517.60
5.5.300.0100.03417.49
5.5.290.0120.04417.61
5.5.280.0100.03517.55
5.5.270.0060.02617.72
5.5.260.0080.03817.60
5.5.250.0050.02717.57
5.5.240.0120.03017.15
5.5.230.0120.04017.11
5.5.220.0070.02517.22
5.5.210.0110.03617.36
5.5.200.0080.03417.19
5.5.190.0100.04017.17
5.5.180.0110.02617.25
5.5.170.0030.00914.47
5.5.160.0060.04317.23
5.5.150.0030.02617.20
5.5.140.0080.03617.16
5.5.130.0020.02717.30
5.5.120.0070.02617.23
5.5.110.0030.03017.27
5.5.100.0080.03117.31
5.5.90.0050.02517.16
5.5.80.0160.03417.08
5.5.70.0020.03717.05
5.5.60.0060.04017.33
5.5.50.0100.03817.25
5.5.40.0190.03417.05
5.5.30.0050.02416.98
5.5.20.0030.04417.10
5.5.10.0050.03317.22
5.5.00.0120.03917.18
5.4.450.0100.03715.36
5.4.440.0050.03315.45
5.4.430.0090.02715.33
5.4.420.0090.02815.29
5.4.410.0040.03415.15
5.4.400.0030.02415.13
5.4.390.0030.02915.04
5.4.380.0030.04615.11
5.4.370.0020.02315.15
5.4.360.0050.03415.19
5.4.350.0070.03615.10
5.4.340.0070.02715.05
5.4.330.0040.00411.25
5.4.320.0060.04615.05
5.4.310.0050.02815.26
5.4.300.0050.04015.18
5.4.290.0050.03015.10
5.4.280.0080.03015.13
5.4.270.0080.02015.04
5.4.260.0050.03515.13
5.4.250.0050.02315.23
5.4.240.0070.03215.19
5.4.230.0030.02715.07
5.4.220.0060.02414.99
5.4.210.0070.03715.23
5.4.200.0060.03615.17
5.4.190.0130.01515.05
5.4.180.0050.04015.24
5.4.170.0080.02815.19
5.4.160.0050.03215.09
5.4.150.0070.03215.08
5.4.140.0050.03813.68
5.4.130.0040.03113.90
5.4.120.0080.03613.82
5.4.110.0090.02813.86
5.4.100.0080.01914.00
5.4.90.0080.01813.86
5.4.80.0160.03213.77
5.4.70.0020.03113.85
5.4.60.0070.03513.80
5.4.50.0050.04213.79
5.4.40.0050.02713.85
5.4.30.0070.02413.86
5.4.20.0020.04113.92
5.4.10.0020.04613.73
5.4.00.0030.02813.62
5.3.290.0040.04212.66
5.3.280.0050.03712.68
5.3.270.0040.04212.79
5.3.260.0110.03412.74
5.3.250.0070.04212.80
5.3.240.0100.03712.64
5.3.230.0030.04512.72
5.3.220.0050.02912.48
5.3.210.0070.03112.53
5.3.200.0050.04312.64
5.3.190.0070.03712.68
5.3.180.0030.04312.62
5.3.170.0060.03612.76
5.3.160.0080.03312.73
5.3.150.0020.02512.72
5.3.140.0040.04512.77
5.3.130.0060.04012.66
5.3.120.0090.04012.58
5.3.110.0000.04212.74
5.3.100.0020.02812.42
5.3.90.0030.02512.41
5.3.80.0070.02412.24
5.3.70.0050.03812.34
5.3.60.0040.04112.32
5.3.50.0070.03512.48
5.3.40.0120.03712.42
5.3.30.0030.03012.37
5.3.20.0070.03812.24
5.3.10.0070.03612.14
5.3.00.0020.04112.15
5.2.170.0030.06711.04
5.2.160.0070.06011.21
5.2.150.0030.06311.21
5.2.140.0030.03711.27
5.2.130.0100.05311.20
5.2.120.0070.06311.03
5.2.110.0030.04310.97
5.2.100.0100.05011.12
5.2.90.0000.06011.20
5.2.80.0030.03710.95
5.2.70.0100.05011.02
5.2.60.0030.06310.96
5.2.50.0030.06010.86
5.2.40.0070.06011.12
5.2.30.0030.03711.04
5.2.20.0100.06010.88
5.2.10.0000.04310.89
5.2.00.0070.05710.66
5.1.60.0030.04310.00
5.1.50.0100.04310.07
5.1.40.0030.0539.98
5.1.30.0030.05010.46
5.1.20.0030.05710.37
5.1.10.0070.05310.08
5.1.00.0030.04310.23
5.0.50.0000.0338.63
5.0.40.0070.0408.56
5.0.30.0030.0608.30
5.0.20.0030.0438.17
5.0.10.0070.0338.30
5.0.00.0130.0538.30
4.4.90.0070.0308.07
4.4.80.0000.0378.07
4.4.70.0030.0338.07
4.4.60.0000.0378.07
4.4.50.0000.0308.07
4.4.40.0000.0578.07
4.4.30.0030.0338.07
4.4.20.0100.0308.07
4.4.10.0030.0378.07
4.4.00.0030.0508.07
4.3.110.0030.0338.07
4.3.100.0000.0308.07
4.3.90.0000.0278.07
4.3.80.0000.0438.07
4.3.70.0000.0208.07
4.3.60.0000.0208.07
4.3.50.0070.0338.07
4.3.40.0000.0478.07
4.3.30.0070.0308.07
4.3.20.0070.0338.07
4.3.10.0030.0338.07
4.3.00.0000.0308.07

preferences:
91.66 ms | 401 KiB | 5 Q