3v4l.org

run code in 300+ PHP versions simultaneously
<?php function calcDays($startdate, $enddate) { $first = $startdate < $enddate ? $startdate : $enddate; $second = $startdate < $enddate ? $enddate : $startdate; $inbetween = $second - $first; $i[0] = 60; $i[1] = 24; $i[2] = 7; $i[3] = date('t', strtotime('-1 month', $second)); $i[4] = date('L', strtotime('-1 year', $second)) ? 366 : 365; $i[5] = array(31, (date('L', strtotime('-1 year', $second)) ? 28 : 29), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $months = 0; $days = 0; $temp = floor($inbetween / $i[0] / $i[0] / $i[1]); $tempDays = floor($temp % 365); $tempMonth = date('n', strtotime('-1 year', $second)) - 1; for($n = 0; $n < 12; $n++) { var_dump($tempDays); if($tempDays >= $i[5][$tempMonth]) { $months += 1; $tempDays -= $i[5][$tempMonth]; } else { $days = $tempDays; break; } $tempMonth = $tempMonth < 10 ? $tempMonth + 1 : 0; } $years = date('Y', $second) - date('Y', $first) + $months / 12; $months = $months % 12; $hours = floor($inbetween / $i[0] / $i[0] % $i[1]); $minutes = floor($inbetween / $i[0] % $i[0]); $seconds = $inbetween % $i[0]; return $years . " years " . $months . " months " . $days . " days " . $hours . " hours " . $minutes . " minutes " . $seconds . " seconds"; } echo calcDays(1388389157, 1704094758);

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.0120.00917.13
8.3.50.0120.00621.97
8.3.40.0170.00319.21
8.3.30.0040.01519.10
8.3.20.0110.00720.07
8.3.10.0140.00423.63
8.3.00.0110.00720.64
8.2.180.0140.00718.66
8.2.170.0150.00422.96
8.2.160.0060.01222.25
8.2.150.0170.00324.18
8.2.140.0100.01024.66
8.2.130.0150.00326.16
8.2.120.0080.00020.22
8.2.110.0000.00922.17
8.2.100.0040.00818.14
8.2.90.0050.00319.16
8.2.80.0050.00318.13
8.2.70.0080.00017.97
8.2.60.0000.00918.18
8.2.50.0040.00418.07
8.2.40.0030.00519.50
8.2.30.0070.00018.35
8.2.20.0050.00318.19
8.2.10.0000.00818.14
8.2.00.0000.00818.23
8.1.280.0100.00725.92
8.1.270.0030.00624.00
8.1.260.0120.00626.35
8.1.250.0150.00328.09
8.1.240.0030.00624.10
8.1.230.0070.00319.22
8.1.220.0000.00817.79
8.1.210.0030.00618.77
8.1.200.0030.00617.72
8.1.190.0080.00017.75
8.1.180.0030.00618.10
8.1.170.0050.00318.90
8.1.160.0000.00822.07
8.1.150.0030.00618.99
8.1.140.0000.00817.91
8.1.130.0000.00717.97
8.1.120.0000.00817.73
8.1.110.0040.00417.85
8.1.100.0050.00217.80
8.1.90.0040.00417.80
8.1.80.0030.00317.85
8.1.70.0030.00317.72
8.1.60.0130.00017.83
8.1.50.0040.00417.84
8.1.40.0040.00417.78
8.1.30.0050.00317.76
8.1.20.0040.00417.92
8.1.10.0000.00717.85
8.1.00.0080.00017.74
8.0.300.0000.00718.77
8.0.290.0070.00017.55
8.0.280.0070.00018.64
8.0.270.0000.00717.50
8.0.260.0070.00017.29
8.0.250.0000.00717.38
8.0.240.0030.00617.33
8.0.230.0000.00817.36
8.0.220.0030.00317.29
8.0.210.0000.00717.27
8.0.200.0000.00617.39
8.0.190.0050.00317.40
8.0.180.0060.00317.34
8.0.170.0040.00417.25
8.0.160.0030.00617.18
8.0.150.0040.00417.22
8.0.140.0000.00817.23
8.0.130.0000.00613.65
8.0.120.0030.00517.23
8.0.110.0030.00517.23
8.0.100.0060.00317.25
8.0.90.0040.00417.29
8.0.80.0140.00317.34
8.0.70.0000.00717.19
8.0.60.0000.00717.28
8.0.50.0060.00317.33
8.0.30.0160.00717.29
8.0.20.0120.00617.51
8.0.10.0000.00917.42
8.0.00.0100.01317.06
7.4.330.0050.00015.38
7.4.320.0070.00016.90
7.4.300.0070.00016.80
7.4.290.0000.00716.80
7.4.280.0030.00316.80
7.4.270.0000.00816.80
7.4.260.0050.00316.84
7.4.250.0040.00416.78
7.4.240.0020.00516.88
7.4.230.0050.00216.91
7.4.220.0130.00616.77
7.4.210.0090.00816.92
7.4.200.0000.00716.98
7.4.190.0040.00416.93
7.4.160.0030.02116.93
7.4.150.0140.00317.40
7.4.140.0110.00717.86
7.4.130.0080.01016.87
7.4.120.0070.01016.83
7.4.110.0090.00916.78
7.4.100.0150.00417.04
7.4.90.0130.00417.04
7.4.80.0090.00916.64
7.4.70.0040.01616.94
7.4.60.0090.01216.85
7.4.50.0000.00716.78
7.4.40.0120.00422.77
7.4.30.0130.00316.84
7.4.00.0050.01215.18
7.3.330.0030.00313.60
7.3.320.0000.00513.45
7.3.310.0030.00516.54
7.3.300.0030.00316.70
7.3.290.0030.01316.57
7.3.280.0070.01216.62
7.3.270.0060.01017.40
7.3.260.0130.01016.60
7.3.250.0080.00916.78
7.3.240.0100.00716.93
7.3.230.0150.01116.79
7.3.210.0100.00716.79
7.3.200.0130.00619.39
7.3.190.0130.00716.62
7.3.180.0100.01016.75
7.3.170.0060.00916.70
7.3.160.0060.00916.73
7.3.120.0050.00915.09
7.3.110.0120.00615.13
7.3.100.0060.00914.94
7.3.90.0070.01115.25
7.3.80.0030.00715.13
7.3.70.0080.00615.13
7.3.60.0000.01015.27
7.3.50.0000.01215.04
7.3.40.0030.01114.99
7.3.30.0060.00314.99
7.3.20.0100.00316.89
7.3.10.0070.00717.11
7.3.00.0070.00716.91
7.2.330.0100.01316.98
7.2.320.0120.00617.05
7.2.310.0060.01117.17
7.2.300.0110.00617.17
7.2.290.0120.00916.86
7.2.250.0030.01415.15
7.2.240.0120.00615.34
7.2.230.0150.00315.36
7.2.220.0040.00815.05
7.2.210.0060.00615.36
7.2.200.0030.01415.40
7.2.190.0030.01515.44
7.2.180.0030.01215.34
7.2.170.0030.00615.23
7.2.130.0060.00617.37
7.2.120.0030.00917.02
7.2.110.0040.00717.27
7.2.100.0030.00816.91
7.2.90.0000.00917.10
7.2.80.0030.01017.31
7.2.70.0070.00317.18
7.2.60.0080.00016.81
7.2.50.0030.01017.22
7.2.40.0070.00717.20
7.2.30.0040.01117.13
7.2.20.0050.00516.98
7.2.10.0080.00517.16
7.2.00.0040.01118.21
7.1.330.0030.01116.04
7.1.320.0040.00716.07
7.1.310.0040.01116.14
7.1.300.0030.00615.64
7.1.290.0060.00916.18
7.1.280.0030.01215.94
7.1.270.0030.00816.09
7.1.260.0090.00615.80
7.1.250.0000.01216.02
7.1.100.0040.01118.12
7.1.70.0080.00317.32
7.1.60.0140.01119.29
7.1.50.0060.01617.21
7.1.00.0030.07722.28
7.0.200.0040.00817.00
7.0.140.0070.07022.00
7.0.90.0100.08019.95
7.0.80.0200.04319.93
7.0.70.0070.03720.18
7.0.60.0200.04319.95
7.0.50.0170.09720.30
7.0.40.0000.04319.99
7.0.30.0100.04020.18
7.0.20.0030.03720.02
7.0.10.0000.04020.17
7.0.00.0000.04020.16
5.6.280.0030.07321.05
5.6.240.0030.05320.71
5.6.230.0070.08020.52
5.6.220.0100.06720.75
5.6.210.0100.05020.62
5.6.200.0070.10020.91
5.6.190.0070.04021.13
5.6.180.0070.04021.04
5.6.170.0070.04720.97
5.6.160.0170.03321.04
5.6.150.0070.03320.97
5.6.140.0070.03721.04
5.6.130.0070.03321.04
5.6.120.0070.04021.10
5.6.110.0130.03721.03
5.6.100.0100.03321.03
5.6.90.0000.04020.95
5.6.80.0070.03020.46
5.6.70.0000.04320.53
5.6.60.0000.03720.32
5.6.50.0030.04320.45
5.6.40.0000.03720.33
5.6.30.0030.04020.55
5.6.20.0030.03320.45
5.6.10.0030.04720.28
5.6.00.0000.03720.43
5.5.380.0100.07720.48
5.5.370.0100.07720.49
5.5.360.0100.07720.41
5.5.350.0070.07720.48
5.5.340.0130.03020.90
5.5.330.0030.05020.80
5.5.320.0170.03020.80
5.5.310.0070.03720.88
5.5.300.0100.03320.79
5.5.290.0030.03720.88
5.5.280.0070.04020.90
5.5.270.0030.04320.84
5.5.260.0070.04020.90
5.5.250.0000.04320.66
5.5.240.0030.03720.17
5.5.230.0070.04320.14
5.5.220.0100.03320.04
5.5.210.0000.04320.17
5.5.200.0030.07320.11
5.5.190.0000.04320.27
5.5.180.0070.04320.23
5.5.160.0070.03320.20
5.5.150.0030.03320.13
5.5.140.0030.04320.24
5.5.130.0070.03720.29
5.5.120.0030.03320.24
5.5.110.0030.03320.16
5.5.100.0030.03720.10
5.5.90.0100.03020.19
5.5.80.0070.03320.00
5.5.70.0030.05719.98
5.5.60.0130.02720.17
5.5.50.0100.04720.11
5.5.40.0100.08019.98
5.5.30.0000.07719.98
5.5.20.0030.08720.13
5.5.10.0130.07020.00
5.5.00.0070.07719.97
5.4.450.0100.03019.47
5.4.440.0070.04019.45
5.4.430.0070.03319.53
5.4.420.0030.03319.35
5.4.410.0070.03019.24
5.4.400.0070.03319.19
5.4.390.0030.04018.88
5.4.380.0100.03319.15
5.4.370.0100.02718.90
5.4.360.0070.04719.05
5.4.350.0000.03319.13
5.4.340.0030.03318.88
5.4.320.0070.03019.12
5.4.310.0070.03719.16
5.4.300.0030.03019.09
5.4.290.0030.04019.09
5.4.280.0030.03319.12
5.4.270.0000.03319.18
5.4.260.0030.04018.90
5.4.250.0070.03719.02
5.4.240.0000.03318.94
5.4.230.0100.02718.89
5.4.220.0100.07719.06
5.4.210.0070.07019.20
5.4.200.0070.05319.11
5.4.190.0000.08318.83
5.4.180.0030.04319.12
5.4.170.0070.07318.94
5.4.160.0000.04718.88
5.4.150.0000.08019.10
5.4.140.0030.07316.50
5.4.130.0070.07016.48
5.4.120.0070.07016.48
5.4.110.0130.06716.41
5.4.100.0100.07016.41
5.4.90.0030.04716.49
5.4.80.0100.06316.47
5.4.70.0070.07716.40
5.4.60.0100.05316.33
5.4.50.0000.08016.48
5.4.40.0070.08016.49
5.4.30.0070.07316.39
5.4.20.0070.04716.45
5.4.10.0070.06716.40
5.4.00.0030.06015.86
5.3.290.0070.04714.66
5.3.280.0000.03314.59
5.3.270.0070.06714.55
5.3.260.0170.07014.68
5.3.250.0100.06714.62
5.3.240.0030.08314.62
5.3.230.0070.05314.76
5.3.220.0000.05714.70
5.3.210.0070.04314.52
5.3.200.0030.07714.51
5.3.190.0000.04014.72
5.3.180.0070.04014.67
5.3.170.0030.05014.59
5.3.160.0070.07714.59
5.3.150.0130.04314.64
5.3.140.0170.06314.56
5.3.130.0000.08014.63
5.3.120.0000.06314.59
5.3.110.0100.06314.55
5.3.100.0130.05714.20
5.3.90.0030.04713.97
5.3.80.0030.03714.16
5.3.70.0070.06714.02
5.3.60.0000.05314.08
5.3.50.0100.05313.96
5.3.40.0070.03713.96
5.3.30.0100.06713.86
5.3.20.0070.04313.84
5.3.10.0070.03013.69
5.3.00.0030.05013.77
5.2.170.0030.03012.71
5.2.160.0030.03312.71
5.2.150.0100.04712.71
5.2.140.0000.03012.71
5.2.130.0000.05312.71
5.2.120.0000.03012.71
5.2.110.0030.02712.71
5.2.100.0030.05312.71
5.2.90.0130.03012.71
5.2.80.0030.06312.71
5.2.70.0130.02012.71
5.2.60.0030.02712.71
5.2.50.0070.06012.71
5.2.40.0100.05712.71
5.2.30.0000.04312.71
5.2.20.0070.03312.71
5.2.10.0030.05012.71
5.2.00.0000.06712.71
5.1.60.0030.05712.71
5.1.50.0000.05312.71
5.1.40.0030.03012.71
5.1.30.0100.05312.71
5.1.20.0070.03712.71
5.1.10.0000.03712.71
5.1.00.0100.02312.71
5.0.50.0070.03712.71
5.0.40.0070.03012.71
5.0.30.0030.02712.71
5.0.20.0030.02012.71
5.0.10.0000.02012.71
5.0.00.0000.03312.71
4.4.90.0030.01312.71
4.4.80.0000.02012.71
4.4.70.0070.02312.71
4.4.60.0000.02712.71
4.4.50.0030.02012.71
4.4.40.0070.03312.71
4.4.30.0030.03312.71
4.4.20.0000.01712.71
4.4.10.0000.03312.71
4.4.00.0100.02012.71
4.3.110.0030.03012.71
4.3.100.0070.01012.71
4.3.90.0000.01712.71
4.3.80.0030.02012.71
4.3.70.0000.02012.71
4.3.60.0000.01712.71
4.3.50.0030.01712.71
4.3.40.0030.05012.71
4.3.30.0000.02312.71
4.3.20.0000.02312.71
4.3.10.0070.03012.71
4.3.00.0000.01712.71

preferences:
47.47 ms | 401 KiB | 5 Q