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]); $tempMonth = date('n', strtotime('-1 year', $second)) - 1; for($n = 0; $n < 12; $n++) { if($temp >= $i[5][$tempMonth]) { $months += 1; $temp -= $i[5][$tempMonth]; } else { $days = $temp; break; } $tempMonth = $tempMonth < 10 ? $tempMonth + 1 : 0; } $years = $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, 1704094757);

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.0140.00718.55
8.3.50.0090.01021.21
8.3.40.0070.01119.04
8.3.30.0040.00920.17
8.3.20.0000.00720.30
8.3.10.0040.00421.92
8.3.00.0060.00322.43
8.2.180.0180.00016.63
8.2.170.0070.00722.96
8.2.160.0100.00322.23
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0000.00820.82
8.2.110.0040.00422.38
8.2.100.0060.00618.28
8.2.90.0040.00419.48
8.2.80.0040.00419.41
8.2.70.0040.00418.00
8.2.60.0050.00518.05
8.2.50.0030.00518.07
8.2.40.0000.00818.40
8.2.30.0040.00419.54
8.2.20.0000.00817.98
8.2.10.0030.00618.10
8.2.00.0040.00418.14
8.1.280.0100.01325.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0060.00320.89
8.1.230.0110.00021.03
8.1.220.0080.00017.85
8.1.210.0000.00818.77
8.1.200.0030.00717.60
8.1.190.0000.00817.78
8.1.180.0040.00418.10
8.1.170.0040.00418.72
8.1.160.0090.00019.05
8.1.150.0040.00418.89
8.1.140.0050.00217.85
8.1.130.0030.00317.91
8.1.120.0000.00717.72
8.1.110.0000.00817.64
8.1.100.0040.00417.78
8.1.90.0000.00717.63
8.1.80.0050.00217.57
8.1.70.0000.00717.72
8.1.60.0040.00417.79
8.1.50.0050.00317.76
8.1.40.0000.00917.73
8.1.30.0030.00617.77
8.1.20.0030.00517.91
8.1.10.0040.00417.80
8.1.00.0000.00917.74
8.0.300.0060.00318.77
8.0.290.0070.00017.43
8.0.280.0040.00418.60
8.0.270.0050.00517.43
8.0.260.0040.00417.23
8.0.250.0070.00017.27
8.0.240.0030.00517.29
8.0.230.0040.00417.26
8.0.220.0040.00417.18
8.0.210.0000.00717.24
8.0.200.0000.00617.30
8.0.190.0060.00317.21
8.0.180.0040.00417.23
8.0.170.0080.00017.30
8.0.160.0040.00417.16
8.0.150.0030.00617.13
8.0.140.0000.00717.13
8.0.130.0000.00613.61
8.0.120.0080.00017.12
8.0.110.0000.00817.29
8.0.100.0050.00317.20
8.0.90.0040.00417.12
8.0.80.0150.00017.25
8.0.70.0040.00417.06
8.0.60.0030.00617.15
8.0.50.0000.00717.16
8.0.30.0120.01317.50
8.0.20.0110.00817.48
8.0.10.0000.00817.41
8.0.00.0160.00617.13
7.4.330.0050.00016.71
7.4.320.0030.00316.83
7.4.300.0070.00016.63
7.4.290.0050.00216.75
7.4.280.0000.00716.77
7.4.270.0000.00716.78
7.4.260.0050.00313.44
7.4.250.0000.00916.84
7.4.240.0020.00616.83
7.4.230.0030.00316.84
7.4.220.0060.01316.60
7.4.210.0090.00516.77
7.4.200.0000.00716.76
7.4.190.0030.00317.00
7.4.160.0100.01316.72
7.4.150.0080.01117.40
7.4.140.0140.00317.86
7.4.130.0080.00916.79
7.4.120.0120.00516.83
7.4.110.0070.01016.98
7.4.100.0060.01216.77
7.4.90.0130.00316.83
7.4.80.0120.00919.39
7.4.70.0030.01316.57
7.4.60.0100.00616.80
7.4.50.0000.00916.56
7.4.40.0100.00722.77
7.4.30.0120.00416.55
7.4.00.0070.00715.21
7.3.330.0000.00513.55
7.3.320.0050.00013.60
7.3.310.0030.00616.43
7.3.300.0030.00316.59
7.3.290.0030.01016.63
7.3.280.0110.00816.59
7.3.270.0130.00417.40
7.3.260.0090.00918.24
7.3.250.0100.00816.80
7.3.240.0090.00916.83
7.3.230.0140.00316.49
7.3.210.0030.01416.50
7.3.200.0150.00819.39
7.3.190.0030.01716.75
7.3.180.0030.01216.58
7.3.170.0100.01016.66
7.3.160.0070.01016.84
7.3.120.0090.00015.05
7.2.330.0040.01417.06
7.2.320.0030.01417.19
7.2.310.0100.01916.96
7.2.300.0060.01117.11
7.2.290.0100.00716.78
7.1.70.0040.00417.10
7.1.60.0060.01319.17
7.1.50.0100.01017.34
7.1.00.0030.03322.30
7.0.200.0000.00716.71
7.0.140.0070.07021.97
7.0.100.0070.04320.04
7.0.90.0030.05019.91
7.0.80.0070.04719.88
7.0.70.0100.07020.07
7.0.60.0070.07020.02
7.0.50.0300.08320.34
7.0.40.0100.09020.13
7.0.30.0030.09320.11
7.0.20.0000.04720.18
7.0.10.0030.05720.04
7.0.00.0100.05720.14
5.6.280.0000.07721.14
5.6.250.0100.07320.77
5.6.240.0030.09020.53
5.6.230.0070.08020.70
5.6.220.0130.06320.56
5.6.210.0070.08020.77
5.6.200.0070.07721.16
5.6.190.0030.07321.15
5.6.180.0130.07721.10
5.6.170.0070.07321.04
5.6.160.0070.08021.04
5.6.150.0130.05721.09
5.6.140.0070.08320.98
5.6.130.0100.10721.19
5.6.120.0070.09321.08
5.6.110.0070.08721.18
5.6.100.0100.03321.14
5.6.90.0000.08321.02
5.6.80.0070.03320.42
5.6.70.0070.05720.40
5.6.60.0000.07720.32
5.6.50.0200.03720.43
5.6.40.0130.07020.41
5.6.30.0030.03720.46
5.6.20.0100.08020.41
5.6.10.0030.04720.45
5.6.00.0100.05720.45
5.5.380.0100.07720.38
5.5.370.0130.04720.41
5.5.360.0030.08720.37
5.5.350.0070.04720.46
5.5.340.0070.04020.93
5.5.330.0100.08320.67
5.5.320.0000.05720.89
5.5.310.0130.07720.95
5.5.300.0030.05020.85
5.5.290.0070.06020.82
5.5.280.0170.08020.91
5.5.270.0030.05020.88
5.5.260.0070.08320.93
5.5.250.0130.07020.75
5.5.240.0070.07720.32
5.5.230.0030.03720.16
5.5.220.0070.06720.16
5.5.210.0070.07320.23
5.5.200.0070.06320.20
5.5.190.0100.07020.20
5.5.180.0100.03320.29
5.5.160.0030.08320.30
5.5.150.0170.06320.24
5.5.140.0070.03720.25
5.5.130.0100.03020.01
5.5.120.0130.07320.24
5.5.110.0230.06720.14
5.5.100.0000.04020.10
5.5.90.0170.06320.03
5.5.80.0070.07720.10
5.5.70.0100.08020.08
5.5.60.0070.04720.13
5.5.50.0070.07020.17
5.5.40.0100.07020.11
5.5.30.0100.04020.05
5.5.20.0100.05719.94
5.5.10.0030.04720.15
5.5.00.0070.08020.11
5.4.450.0000.09019.48
5.4.440.0070.08719.23
5.4.430.0030.03719.20
5.4.420.0100.06019.35
5.4.410.0030.03719.14
5.4.400.0070.06718.91
5.4.390.0030.07719.13
5.4.380.0030.08019.14
5.4.370.0030.07319.08
5.4.360.0130.07019.25
5.4.350.0000.04319.05
5.4.340.0070.05319.15
5.4.320.0070.06719.05
5.4.310.0070.07319.05
5.4.300.0100.04318.89
5.4.290.0130.07019.13
5.4.280.0130.06718.88
5.4.270.0000.08318.87
5.4.260.0070.07019.13
5.4.250.0070.03719.03
5.4.240.0000.08718.83
5.4.230.0030.04319.13
5.4.220.0070.06019.15
5.4.210.0070.04018.96
5.4.200.0030.04019.02
5.4.190.0100.07718.84
5.4.180.0100.04019.02
5.4.170.0100.06318.83
5.4.160.0130.06319.01
5.4.150.0070.04718.89
5.4.140.0100.06316.39
5.4.130.0070.04716.46
5.4.120.0070.06716.24
5.4.110.0100.03716.46
5.4.100.0070.04016.55
5.4.90.0030.06316.56
5.4.80.0000.04316.54
5.4.70.0070.04016.55
5.4.60.0100.07016.33
5.4.50.0030.03716.42
5.4.40.0100.03716.35
5.4.30.0100.05716.36
5.4.20.0030.03716.26
5.4.10.0070.03716.40
5.4.00.0070.05315.65
5.3.290.0100.07714.75
5.3.280.0000.06714.61
5.3.270.0030.07714.73
5.3.260.0030.07314.57
5.3.250.0100.06014.56
5.3.240.0000.04714.68
5.3.230.0030.03714.68
5.3.220.0000.04314.66
5.3.210.0130.03314.65
5.3.200.0030.04014.61
5.3.190.0070.07714.51
5.3.180.0070.04014.64
5.3.170.0030.04314.52
5.3.160.0100.07314.68
5.3.150.0030.03714.57
5.3.140.0030.03714.56
5.3.130.0070.06014.62
5.3.120.0130.03714.58
5.3.110.0070.05314.63
5.3.100.0070.06314.00
5.3.90.0100.06314.03
5.3.80.0100.03714.14
5.3.70.0070.04014.09
5.3.60.0070.03313.94
5.3.50.0030.07014.09
5.3.40.0100.07013.90
5.3.30.0100.06313.86
5.3.20.0100.07013.77
5.3.10.0000.04313.62
5.3.00.0000.04713.56
5.2.170.0000.03311.15
5.2.160.0030.03311.19
5.2.150.0030.05711.25
5.2.140.0000.06011.02
5.2.130.0030.06311.11
5.2.120.0130.05710.98
5.2.110.0000.05311.04
5.2.100.0000.03710.98
5.2.90.0030.05011.18
5.2.80.0070.03011.05
5.2.70.0030.03311.18
5.2.60.0070.02711.19
5.2.50.0000.03011.18
5.2.40.0000.03011.13
5.2.30.0030.02711.09
5.2.20.0030.02711.07
5.2.10.0030.05711.02
5.2.00.0070.03010.87
5.1.60.0070.04710.52
5.1.50.0030.05010.52
5.1.40.0030.04310.52
5.1.30.0070.04310.52
5.1.20.0100.02010.52
5.1.10.0070.04010.52
5.1.00.0030.03010.52
5.0.50.0000.04710.52
5.0.40.0000.04010.52
5.0.30.0030.05310.52
5.0.20.0000.02010.52
5.0.10.0000.04710.52
5.0.00.0000.06310.52
4.4.90.0070.01710.52
4.4.80.0070.01310.52
4.4.70.0000.03710.52
4.4.60.0000.03310.52
4.4.50.0000.02310.52
4.4.40.0000.03710.52
4.4.30.0000.01710.52
4.4.20.0070.03710.52
4.4.10.0030.01310.52
4.4.00.0070.01710.52
4.3.110.0030.01310.52
4.3.100.0000.02710.52
4.3.90.0000.01310.52
4.3.80.0030.04710.52
4.3.70.0070.03010.52
4.3.60.0030.01310.52
4.3.50.0000.03710.52
4.3.40.0000.02310.52
4.3.30.0000.01710.52
4.3.20.0030.03010.52
4.3.10.0000.01710.52
4.3.00.0000.03010.52

preferences:
45.17 ms | 401 KiB | 5 Q