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); $days = 0; for($n = 0; $n < 12; $n++) { $temp = $inbetween / $i[0] / $i[0] / $i[1]; $tempMonth = date('n', strtotime('-1 year', $second)) - 1; if($temp >= $i[5][$tempMonth]) { $temp -= $i[5][$tempMonth]; } else { $days = $temp; var_dump($days); break; } } $month = floor($inbetween / $i[0] / $i[0] / $i[1] / $i[3] % $i[4]); //$days = floor($inbetween / $i[0] / $i[0] / $i[1] % $i[3]); $hours = floor($inbetween / $i[0] / $i[0] % $i[1]); $minutes = floor($inbetween / $i[0] % $i[0]); $seconds = $inbetween % $i[0]; return $month . " " . $days . " " . $hours . " " . $minutes . " " . $seconds . " " . $inbetween; } echo calcDays(1388389157, 1419925156);

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.70.0120.00616.98
8.3.60.0130.00718.55
8.3.50.0110.00821.15
8.3.40.0120.00319.17
8.3.30.0110.00420.20
8.3.20.0060.00320.30
8.3.10.0030.00521.25
8.3.00.0040.00422.40
8.2.180.0040.01518.66
8.2.170.0140.00722.96
8.2.160.0140.00321.99
8.2.150.0040.00424.18
8.2.140.0030.00624.66
8.2.130.0040.00426.16
8.2.120.0080.00021.05
8.2.110.0030.00619.17
8.2.100.0120.00018.16
8.2.90.0030.00619.53
8.2.80.0040.00418.04
8.2.70.0000.00817.88
8.2.60.0000.00818.05
8.2.50.0000.00918.07
8.2.40.0030.00618.46
8.2.30.0050.00219.55
8.2.20.0000.00918.04
8.2.10.0000.00718.01
8.2.00.0080.00018.11
8.1.280.0070.01025.92
8.1.270.0030.00623.99
8.1.260.0050.00326.35
8.1.250.0080.00028.09
8.1.240.0030.00624.00
8.1.230.0080.00420.89
8.1.220.0040.00418.77
8.1.210.0000.00819.07
8.1.200.0060.00317.48
8.1.190.0050.00317.77
8.1.180.0000.00818.10
8.1.170.0030.00518.82
8.1.160.0040.00419.10
8.1.150.0050.00218.91
8.1.140.0080.00017.78
8.1.130.0000.00718.00
8.1.120.0030.00617.75
8.1.110.0070.00017.75
8.1.100.0040.00317.70
8.1.90.0000.00717.74
8.1.80.0000.00717.78
8.1.70.0000.00717.63
8.1.60.0090.00017.77
8.1.50.0050.00317.79
8.1.40.0000.00817.72
8.1.30.0030.00617.77
8.1.20.0050.00317.83
8.1.10.0060.00317.71
8.1.00.0050.00317.80
8.0.300.0040.00420.14
8.0.290.0040.00417.53
8.0.280.0000.00718.67
8.0.270.0050.00217.44
8.0.260.0030.00317.22
8.0.250.0030.00317.30
8.0.240.0040.00417.23
8.0.230.0000.00917.28
8.0.220.0040.00417.25
8.0.210.0000.00717.15
8.0.200.0000.00617.29
8.0.190.0030.00417.28
8.0.180.0030.00617.33
8.0.170.0030.00517.28
8.0.160.0030.00317.22
8.0.150.0040.00417.17
8.0.140.0070.00017.20
8.0.130.0000.00613.54
8.0.120.0050.00317.23
8.0.110.0040.00417.06
8.0.100.0030.00517.24
8.0.90.0050.00217.27
8.0.80.0060.01017.26
8.0.70.0040.00417.14
8.0.60.0040.00417.30
8.0.50.0040.00417.32
8.0.30.0110.00817.28
8.0.20.0120.01017.53
8.0.10.0040.00417.42
8.0.00.0110.00816.93
7.4.330.0060.00016.84
7.4.320.0070.00016.79
7.4.300.0000.00816.73
7.4.290.0070.00016.81
7.4.280.0070.00016.72
7.4.270.0030.00316.84
7.4.260.0000.00713.37
7.4.250.0040.00416.75
7.4.240.0040.00416.79
7.4.230.0000.00716.59
7.4.220.0150.00416.68
7.4.210.0110.00416.79
7.4.200.0030.00316.76
7.4.190.0070.00016.92
7.4.160.0060.01016.76
7.4.150.0140.00417.40
7.4.140.0060.01117.86
7.4.130.0110.00616.84
7.4.120.0100.00716.87
7.4.110.0100.00616.76
7.4.100.0120.00916.85
7.4.90.0110.00616.82
7.4.80.0090.00919.39
7.4.70.0060.01016.89
7.4.60.0030.01616.55
7.4.50.0040.00416.54
7.4.40.0030.01322.77
7.4.30.0100.00716.79
7.4.00.0120.00315.29
7.3.330.0020.00213.43
7.3.320.0050.00013.41
7.3.310.0080.00016.62
7.3.300.0080.00016.60
7.3.290.0120.00316.57
7.3.280.0070.01116.56
7.3.270.0090.00917.40
7.3.260.0070.01118.24
7.3.250.0110.00716.72
7.3.240.0140.00616.70
7.3.230.0160.00616.81
7.3.210.0060.01116.91
7.3.200.0160.00019.39
7.3.190.0130.01016.56
7.3.180.0100.01116.57
7.3.170.0100.00716.52
7.3.160.0080.00816.66
7.3.120.0110.00315.13
7.2.330.0120.00917.02
7.2.320.0060.01117.02
7.2.310.0130.00917.09
7.2.300.0090.00916.84
7.2.290.0110.00616.85
7.2.60.0100.00317.14
7.2.00.0050.00819.16
7.1.200.0030.01015.82
7.1.100.0110.00318.32
7.1.70.0000.01017.38
7.1.60.0070.01419.17
7.1.50.0130.01017.23
7.1.00.0030.03322.30
7.0.200.0040.00417.05
7.0.140.0030.07322.00
7.0.80.0030.05720.16
7.0.70.0100.07319.97
7.0.60.0070.05320.04
7.0.50.0030.08320.43
7.0.40.0070.05320.14
7.0.30.0100.07020.04
7.0.20.0030.09320.09
7.0.10.0130.08019.98
7.0.00.0230.06320.11
5.6.280.0000.07720.93
5.6.230.0030.04320.62
5.6.220.0130.07020.54
5.6.210.0070.08320.64
5.6.200.0100.04720.97
5.6.190.0030.08320.98
5.6.180.0000.08721.13
5.6.170.0070.07721.06
5.6.160.0070.07321.13
5.6.150.0100.07720.97
5.6.140.0130.07320.95
5.6.130.0030.05321.04
5.6.120.0030.08021.12
5.6.110.0000.08721.18
5.6.100.0070.08021.05
5.6.90.0100.04021.11
5.6.80.0100.07720.36
5.6.70.0070.07720.57
5.6.60.0070.07320.47
5.6.50.0070.05720.41
5.6.40.0030.04720.44
5.6.30.0030.07720.45
5.6.20.0100.07020.41
5.6.10.0130.08020.43
5.6.00.0130.07720.30
5.5.370.0030.04720.38
5.5.360.0030.08720.52
5.5.350.0070.06020.44
5.5.340.0200.07020.89
5.5.330.0030.06320.92
5.5.320.0170.05020.85
5.5.310.0170.07020.91
5.5.300.0070.08320.94
5.5.290.0100.07720.95
5.5.280.0100.08720.73
5.5.270.0100.06720.77
5.5.260.0100.06020.84
5.5.250.0100.07020.75
5.5.240.0170.04020.29
5.5.230.0100.07020.17
5.5.220.0100.06720.32
5.5.210.0070.05720.27
5.5.200.0100.08320.25
5.5.190.0070.07020.15
5.5.180.0030.05720.20
5.5.160.0070.08020.29
5.5.150.0000.05320.14
5.5.140.0030.06020.24
5.5.130.0070.04320.01
5.5.120.0000.08320.23
5.5.110.0030.07720.01
5.5.100.0070.08020.18
5.5.90.0170.05720.09
5.5.80.0170.07020.17
5.5.70.0100.07320.18
5.5.60.0070.08020.08
5.5.50.0030.05720.13
5.5.40.0070.07320.12
5.5.30.0070.06719.95
5.5.20.0130.06720.16
5.5.10.0070.08019.98
5.5.00.0030.07020.04
5.4.450.0100.07719.36
5.4.440.0100.07319.45
5.4.430.0130.07319.35
5.4.420.0070.07319.51
5.4.410.0030.07319.23
5.4.400.0100.06318.89
5.4.390.0070.08018.97
5.4.380.0030.08318.88
5.4.370.0070.07719.16
5.4.360.0070.05719.18
5.4.350.0000.04718.89
5.4.340.0130.07319.23
5.4.320.0030.07319.16
5.4.310.0130.07719.16
5.4.300.0100.08019.12
5.4.290.0130.06718.87
5.4.280.0170.06719.05
5.4.270.0100.07718.94
5.4.260.0100.07718.95
5.4.250.0030.06719.15
5.4.240.0000.07719.12
5.4.230.0130.07318.90
5.4.220.0030.08719.15
5.4.210.0170.07019.04
5.4.200.0070.07719.08
5.4.190.0100.06319.11
5.4.180.0070.04019.17
5.4.170.0030.05718.89
5.4.160.0070.06018.93
5.4.150.0030.08019.10
5.4.140.0100.05716.34
5.4.130.0070.07316.40
5.4.120.0030.07016.44
5.4.110.0030.04716.53
5.4.100.0030.05716.44
5.4.90.0070.07016.38
5.4.80.0070.04016.50
5.4.70.0100.05316.43
5.4.60.0070.07016.30
5.4.50.0130.07016.53
5.4.40.0070.07316.30
5.4.30.0030.07016.50
5.4.20.0200.05016.25
5.4.10.0100.05316.42
5.4.00.0000.08015.64
5.3.290.0000.08314.82
5.3.280.0100.08014.63
5.3.270.0100.06714.56
5.3.260.0030.06314.61
5.3.250.0070.07714.65
5.3.240.0030.05014.76
5.3.230.0030.08014.68
5.3.220.0100.06714.72
5.3.210.0070.07014.55
5.3.200.0130.06714.61
5.3.190.0030.05714.70
5.3.180.0100.07014.64
5.3.170.0070.06714.54
5.3.160.0030.07714.69
5.3.150.0100.07014.50
5.3.140.0100.07314.60
5.3.130.0100.06714.54
5.3.120.0030.08314.55
5.3.110.0070.08014.58
5.3.100.0100.07314.07
5.3.90.0130.06714.18
5.3.80.0100.07013.95
5.3.70.0130.06014.19
5.3.60.0030.07714.02
5.3.50.0070.07314.09
5.3.40.0070.07313.88
5.3.30.0070.07314.06
5.3.20.0130.06313.78
5.3.10.0070.03313.79
5.3.00.0070.07013.68
5.2.170.0100.05711.16
5.2.160.0030.06311.09
5.2.150.0130.05311.21
5.2.140.0030.06711.16
5.2.130.0100.06011.04
5.2.120.0000.04311.05
5.2.110.0000.03711.11
5.2.100.0070.04711.21
5.2.90.0000.05311.18
5.2.80.0070.06311.12
5.2.70.0000.06311.03
5.2.60.0030.06310.96
5.2.50.0030.07010.91
5.2.40.0030.06311.03
5.2.30.0070.06311.05
5.2.20.0070.04710.96
5.2.10.0030.04310.78
5.2.00.0070.06310.76
5.1.60.0070.05310.06
5.1.50.0030.05010.07
5.1.40.0070.04310.00
5.1.30.0000.06010.42
5.1.20.0070.04710.49
5.1.10.0000.0409.93
5.1.00.0030.05310.15
5.0.50.0030.0478.66
5.0.40.0000.0478.53
5.0.30.0030.0608.34
5.0.20.0070.0408.32
5.0.10.0000.0338.28
5.0.00.0000.0678.29
4.4.90.0000.0236.95
4.4.80.0100.0306.95
4.4.70.0030.0376.95
4.4.60.0030.0336.95
4.4.50.0070.0306.95
4.4.40.0000.0576.95
4.4.30.0070.0336.95
4.4.20.0070.0236.95
4.4.10.0030.0236.95
4.4.00.0000.0476.95
4.3.110.0000.0376.95
4.3.100.0030.0176.95
4.3.90.0070.0306.95
4.3.80.0070.0476.95
4.3.70.0030.0336.95
4.3.60.0070.0206.95
4.3.50.0000.0376.95
4.3.40.0000.0576.95
4.3.30.0000.0306.95
4.3.20.0000.0206.95
4.3.10.0000.0406.95
4.3.00.0000.0376.95

preferences:
53.58 ms | 401 KiB | 5 Q