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 = $i[5][$tempMonth]; 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(1388389156, 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.60.0090.00618.55
8.3.50.0100.00721.21
8.3.40.0090.00619.22
8.3.30.0100.00320.40
8.3.20.0060.00320.16
8.3.10.0000.00821.20
8.3.00.0050.00322.58
8.2.180.0070.01416.75
8.2.170.0040.01122.96
8.2.160.0100.00722.31
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0080.00020.91
8.2.110.0060.00319.51
8.2.100.0120.00018.28
8.2.90.0050.00319.33
8.2.80.0040.00418.16
8.2.70.0070.00317.75
8.2.60.0040.00418.18
8.2.50.0000.00818.07
8.2.40.0040.00418.46
8.2.30.0000.00719.55
8.2.20.0080.00017.98
8.2.10.0080.00018.02
8.2.00.0040.00417.95
8.1.280.0110.00725.92
8.1.270.0100.00020.89
8.1.260.0040.00426.35
8.1.250.0060.00328.09
8.1.240.0090.00023.95
8.1.230.0070.00420.84
8.1.220.0050.00318.77
8.1.210.0050.00319.01
8.1.200.0100.00017.35
8.1.190.0040.00417.65
8.1.180.0040.00418.10
8.1.170.0050.00318.84
8.1.160.0040.00419.11
8.1.150.0000.00818.94
8.1.140.0000.00817.64
8.1.130.0000.00718.04
8.1.120.0040.00417.67
8.1.110.0000.00717.68
8.1.100.0000.00717.79
8.1.90.0040.00417.75
8.1.80.0080.00017.73
8.1.70.0030.00317.64
8.1.60.0040.00417.84
8.1.50.0040.00417.75
8.1.40.0000.00917.72
8.1.30.0060.00317.75
8.1.20.0050.00317.93
8.1.10.0040.00417.85
8.1.00.0000.00717.73
8.0.300.0060.00320.27
8.0.290.0000.00717.30
8.0.280.0030.00318.64
8.0.270.0000.00717.36
8.0.260.0050.00317.14
8.0.250.0040.00417.16
8.0.240.0090.00017.30
8.0.230.0080.00017.19
8.0.220.0050.00217.28
8.0.210.0050.00317.14
8.0.200.0060.00317.30
8.0.190.0070.00017.33
8.0.180.0000.00717.18
8.0.170.0040.00417.23
8.0.160.0040.00417.19
8.0.150.0040.00417.18
8.0.140.0040.00417.22
8.0.130.0000.00613.57
8.0.120.0030.00517.09
8.0.110.0070.00017.13
8.0.100.0050.00217.28
8.0.90.0070.00017.32
8.0.80.0120.00617.20
8.0.70.0000.00717.07
8.0.60.0070.00017.14
8.0.50.0000.00717.20
8.0.30.0090.01017.43
8.0.20.0110.01317.53
8.0.10.0040.00417.48
8.0.00.0080.01117.06
7.4.330.0000.00516.77
7.4.320.0000.00716.85
7.4.300.0000.00716.85
7.4.290.0070.00016.81
7.4.280.0040.00416.87
7.4.270.0000.00716.85
7.4.260.0000.00713.44
7.4.250.0000.00816.70
7.4.240.0030.00316.74
7.4.230.0000.00816.94
7.4.220.0130.00616.90
7.4.210.0070.00916.78
7.4.200.0030.00316.70
7.4.190.0030.00316.80
7.4.160.0110.00617.02
7.4.150.0140.00317.40
7.4.140.0130.00917.86
7.4.130.0100.01016.72
7.4.120.0110.00816.79
7.4.110.0060.01216.78
7.4.100.0150.00416.91
7.4.90.0100.00716.74
7.4.80.0150.00919.39
7.4.70.0060.01016.70
7.4.60.0150.00716.88
7.4.50.0090.00016.68
7.4.40.0000.01522.77
7.4.30.0090.00616.62
7.4.00.0130.00315.42
7.3.330.0050.00013.42
7.3.320.0030.00313.40
7.3.310.0000.00716.49
7.3.300.0030.00316.44
7.3.290.0030.01316.51
7.3.280.0130.00716.59
7.3.270.0120.00617.40
7.3.260.0120.00618.24
7.3.250.0090.00916.88
7.3.240.0080.01116.92
7.3.230.0100.00717.02
7.3.210.0130.00716.61
7.3.200.0090.00919.39
7.3.190.0100.01316.89
7.3.180.0140.00316.67
7.3.170.0130.00316.84
7.3.160.0070.01016.79
7.3.120.0030.01015.10
7.2.330.0160.00317.09
7.2.320.0070.01316.96
7.2.310.0100.00716.70
7.2.300.0070.01316.81
7.2.290.0050.01116.79
7.2.60.0070.00717.28
7.1.200.0060.00315.95
7.1.100.0000.00818.57
7.1.70.0040.00417.49
7.1.60.0120.01219.17
7.1.50.0090.00916.94
7.1.00.0070.05322.31
7.0.200.0000.00716.72
7.0.140.0030.07322.21
7.0.90.0070.06321.74
7.0.80.0100.03321.66
7.0.70.0030.07321.76
7.0.60.0000.04721.72
7.0.50.0030.09022.16
7.0.40.0070.07020.04
7.0.30.0000.09020.17
7.0.20.0030.08020.09
7.0.10.0000.08720.09
7.0.00.0030.06719.95
5.6.240.0030.06720.77
5.6.230.0030.08320.55
5.6.220.0030.04320.50
5.6.210.0000.08720.64
5.6.200.0100.08021.00
5.6.190.0030.08320.97
5.6.180.0000.08321.04
5.6.170.0030.08721.07
5.6.160.0100.07721.13
5.6.150.0030.05321.04
5.6.140.0130.06021.09
5.6.130.0000.08721.03
5.6.120.0000.09321.15
5.6.110.0100.08021.13
5.6.100.0070.08021.12
5.6.90.0100.07720.94
5.6.80.0070.07320.48
5.6.70.0100.07720.32
5.6.60.0070.05720.42
5.6.50.0030.04020.46
5.6.40.0030.05720.39
5.6.30.0000.04020.29
5.6.20.0100.07320.39
5.6.10.0030.05320.33
5.6.00.0030.03320.53
5.5.380.0000.07320.41
5.5.370.0000.04320.48
5.5.360.0000.07720.52
5.5.350.0070.03720.47
5.5.340.0030.06320.90
5.5.330.0100.04020.94
5.5.320.0070.08020.88
5.5.310.0000.08320.84
5.5.300.0030.08320.83
5.5.290.0070.05320.78
5.5.280.0100.08320.89
5.5.270.0070.08320.84
5.5.260.0070.08320.89
5.5.250.0000.08320.59
5.5.240.0030.07020.29
5.5.230.0030.07320.28
5.5.220.0030.08020.17
5.5.210.0100.07320.18
5.5.200.0030.03720.20
5.5.190.0000.06020.10
5.5.180.0030.03720.16
5.5.160.0000.04320.14
5.5.150.0030.03720.29
5.5.140.0070.03320.16
5.5.130.0000.04020.12
5.5.120.0030.04720.17
5.5.110.0070.03720.27
5.5.100.0100.03320.18
5.5.90.0030.04320.03
5.5.80.0000.04020.08
5.5.70.0000.04320.08
5.5.60.0000.04320.06
5.5.50.0000.04020.07
5.5.40.0000.09020.11
5.5.30.0030.04719.98
5.5.20.0030.04720.12
5.5.10.0030.03319.98
5.5.00.0000.04320.19
5.4.450.0030.09019.37
5.4.440.0070.08019.37
5.4.430.0130.07319.48
5.4.420.0100.07319.25
5.4.410.0030.07319.23
5.4.400.0000.07719.16
5.4.390.0100.06018.90
5.4.380.0030.07018.90
5.4.370.0030.07319.05
5.4.360.0030.05019.21
5.4.350.0030.04318.91
5.4.340.0000.04019.18
5.4.320.0000.03319.03
5.4.310.0000.03719.16
5.4.300.0070.03319.16
5.4.290.0030.03019.12
5.4.280.0000.04018.87
5.4.270.0000.03719.22
5.4.260.0000.03319.13
5.4.250.0000.04319.12
5.4.240.0070.04019.08
5.4.230.0070.04019.15
5.4.220.0030.06319.12
5.4.210.0100.05318.90
5.4.200.0000.03319.09
5.4.190.0030.03719.07
5.4.180.0000.04319.17
5.4.170.0070.05719.11
5.4.160.0030.05019.13
5.4.150.0030.03719.01
5.4.140.0070.03016.47
5.4.130.0000.03716.24
5.4.120.0030.03316.47
5.4.110.0030.03716.40
5.4.100.0000.03716.41
5.4.90.0030.03316.54
5.4.80.0000.03716.39
5.4.70.0070.03016.31
5.4.60.0000.04016.46
5.4.50.0000.03016.45
5.4.40.0000.06316.35
5.4.30.0000.04316.39
5.4.20.0000.07316.25
5.4.10.0030.06316.33
5.4.00.0070.06715.86
5.3.290.0070.03314.61
5.3.280.0000.03714.68
5.3.270.0000.04014.61
5.3.260.0000.04314.54
5.3.250.0000.03714.73
5.3.240.0000.03714.55
5.3.230.0000.03314.75
5.3.220.0000.03314.68
5.3.210.0000.04014.63
5.3.200.0030.03714.67
5.3.190.0030.04014.60
5.3.180.0000.04314.64
5.3.170.0030.03314.61
5.3.160.0000.06314.56
5.3.150.0000.03314.60
5.3.140.0070.04714.72
5.3.130.0000.07314.59
5.3.120.0070.07314.48
5.3.110.0070.06714.59
5.3.100.0000.04714.16
5.3.90.0000.04014.00
5.3.80.0030.03714.06
5.3.70.0070.04013.98
5.3.60.0030.07714.03
5.3.50.0000.05013.96
5.3.40.0070.07013.86
5.3.30.0000.04014.05
5.3.20.0070.07013.84
5.3.10.0070.07313.68
5.3.00.0000.05313.75
5.2.170.0030.06011.07
5.2.160.0070.05311.26
5.2.150.0070.05711.07
5.2.140.0030.06011.17
5.2.130.0030.04711.24
5.2.120.0030.05311.18
5.2.110.0070.05711.02
5.2.100.0000.06311.23
5.2.90.0000.04710.98
5.2.80.0070.05711.20
5.2.70.0030.04011.24
5.2.60.0030.06311.21
5.2.50.0030.06010.90
5.2.40.0000.06310.93
5.2.30.0000.03710.88
5.2.20.0100.05711.03
5.2.10.0070.05011.02
5.2.00.0030.07010.73
5.1.60.0030.03710.23
5.1.50.0030.05310.23
5.1.40.0030.04710.23
5.1.30.0070.03710.47
5.1.20.0030.05010.38
5.1.10.0030.04310.23
5.1.00.0030.05710.23
5.0.50.0000.04710.23
5.0.40.0100.04010.23
5.0.30.0000.06710.23
5.0.20.0030.04010.23
5.0.10.0070.03010.23
5.0.00.0030.06310.23
4.4.90.0030.03310.23
4.4.80.0000.03310.23
4.4.70.0000.03710.23
4.4.60.0000.03710.23
4.4.50.0030.03310.23
4.4.40.0030.05010.23
4.4.30.0030.03010.23
4.4.20.0030.03310.23
4.4.10.0030.03310.23
4.4.00.0000.05310.23
4.3.110.0030.03010.23
4.3.100.0030.03010.23
4.3.90.0000.03310.23
4.3.80.0000.03310.23
4.3.70.0030.03310.23
4.3.60.0000.03310.23
4.3.50.0030.03010.23
4.3.40.0000.05010.23
4.3.30.0000.02010.23
4.3.20.0000.03710.23
4.3.10.0030.03310.23
4.3.00.0000.03310.23

preferences:
66.59 ms | 401 KiB | 5 Q