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.0170.00318.55
8.3.50.0250.00521.21
8.3.40.0120.00619.17
8.3.30.0080.00620.20
8.3.20.0040.00420.31
8.3.10.0000.00821.06
8.3.00.0040.00422.50
8.2.180.0160.00317.00
8.2.170.0110.00422.96
8.2.160.0100.01022.14
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00420.94
8.2.110.0000.00919.39
8.2.100.0110.00018.16
8.2.90.0000.00919.30
8.2.80.0040.00418.15
8.2.70.0000.00818.00
8.2.60.0000.00818.05
8.2.50.0030.00518.07
8.2.40.0050.00318.46
8.2.30.0000.00819.47
8.2.20.0040.00418.14
8.2.10.0050.00318.04
8.2.00.0040.00418.02
8.1.280.0120.00325.92
8.1.270.0080.00023.99
8.1.260.0100.00026.35
8.1.250.0080.00028.09
8.1.240.0090.00322.05
8.1.230.0040.00821.03
8.1.220.0050.00318.77
8.1.210.0060.00319.14
8.1.200.0030.00717.63
8.1.190.0000.00817.68
8.1.180.0050.00318.10
8.1.170.0030.00618.73
8.1.160.0080.00018.97
8.1.150.0000.00818.99
8.1.140.0050.00217.73
8.1.130.0000.00718.04
8.1.120.0060.00317.77
8.1.110.0000.00717.66
8.1.100.0070.00017.64
8.1.90.0020.00517.74
8.1.80.0040.00417.60
8.1.70.0080.00017.68
8.1.60.0090.00017.80
8.1.50.0070.00017.65
8.1.40.0040.00417.67
8.1.30.0000.00817.85
8.1.20.0040.00417.81
8.1.10.0070.00017.73
8.1.00.0030.00517.77
8.0.300.0040.00420.10
8.0.290.0030.00517.30
8.0.280.0030.00318.60
8.0.270.0000.00717.38
8.0.260.0000.00717.14
8.0.250.0000.00717.19
8.0.240.0000.00817.18
8.0.230.0030.00617.21
8.0.220.0000.00817.15
8.0.210.0070.00017.25
8.0.200.0000.00717.32
8.0.190.0000.00717.20
8.0.180.0000.00817.24
8.0.170.0070.00017.20
8.0.160.0000.00717.23
8.0.150.0080.00017.21
8.0.140.0050.00217.24
8.0.130.0030.00313.57
8.0.120.0070.00017.06
8.0.110.0000.00717.25
8.0.100.0040.00417.10
8.0.90.0070.00017.07
8.0.80.0130.00317.13
8.0.70.0070.00017.14
8.0.60.0030.00517.07
8.0.50.0050.00317.12
8.0.30.0090.01217.33
8.0.20.0090.00917.41
8.0.10.0000.00817.33
8.0.00.0110.00717.13
7.4.330.0020.00216.85
7.4.320.0000.00716.73
7.4.300.0030.00316.74
7.4.290.0030.00316.77
7.4.280.0030.00516.75
7.4.270.0000.00716.69
7.4.260.0000.00513.43
7.4.250.0000.00916.73
7.4.240.0020.00516.80
7.4.230.0000.00716.86
7.4.220.0090.00916.77
7.4.210.0100.00716.85
7.4.200.0000.00716.73
7.4.190.0050.00216.80
7.4.160.0030.01316.64
7.4.150.0070.01017.40
7.4.140.0090.00917.86
7.4.130.0090.01216.77
7.4.120.0050.01217.01
7.4.110.0070.01116.77
7.4.100.0160.00716.71
7.4.90.0030.01416.66
7.4.80.0140.00319.39
7.4.70.0130.00316.82
7.4.60.0100.00616.92
7.4.50.0040.00416.70
7.4.40.0030.01322.77
7.4.30.0000.01617.12
7.4.00.0070.00715.17
7.3.330.0000.00513.62
7.3.320.0030.00213.62
7.3.310.0040.00416.55
7.3.300.0030.00316.64
7.3.290.0120.00316.64
7.3.280.0100.00816.60
7.3.270.0150.00317.40
7.3.260.0110.01118.24
7.3.250.0070.01116.83
7.3.240.0100.00716.92
7.3.230.0120.00916.64
7.3.210.0070.01316.63
7.3.200.0110.00719.39
7.3.190.0120.00916.74
7.3.180.0080.00816.85
7.3.170.0030.01316.88
7.3.160.0090.01216.81
7.3.120.0060.01015.09
7.2.330.0070.01316.80
7.2.320.0070.01016.98
7.2.310.0120.00917.11
7.2.300.0100.00616.70
7.2.290.0100.00716.74
7.2.60.0030.01316.86
7.2.00.0030.01019.48
7.1.200.0120.00315.99
7.1.100.0240.01417.91
7.1.70.0070.00717.35
7.1.60.0110.01519.17
7.1.50.0110.01117.25
7.1.00.0030.04022.30
7.0.200.0000.00816.88
7.0.140.0070.07022.18
7.0.80.0500.08319.82
7.0.70.0500.04720.02
7.0.60.0630.07719.93
7.0.50.0130.06720.37
7.0.40.0030.07020.10
7.0.30.0100.06320.10
7.0.20.0030.05320.08
7.0.10.0200.06320.10
7.0.00.0070.08019.95
5.6.280.0030.07721.06
5.6.230.0100.05020.47
5.6.220.0070.08720.65
5.6.210.0030.04320.58
5.6.200.0070.09020.96
5.6.190.0030.08321.11
5.6.180.0200.06020.98
5.6.170.0130.08020.96
5.6.160.0070.07721.03
5.6.150.0100.08021.10
5.6.140.0230.07021.01
5.6.130.0100.07321.06
5.6.120.0070.08021.05
5.6.110.0030.06021.10
5.6.100.0100.03720.97
5.6.90.0270.06721.06
5.6.80.0030.04720.44
5.6.70.0100.04720.54
5.6.60.0100.07720.45
5.6.50.0070.07720.42
5.6.40.0070.04720.31
5.6.30.0030.05020.40
5.6.20.0070.04720.42
5.6.10.0030.08020.45
5.6.00.0030.08320.42
5.5.370.0100.08320.35
5.5.360.0230.06720.31
5.5.350.0030.08720.42
5.5.340.0030.04320.93
5.5.330.0070.08020.83
5.5.320.0100.08320.91
5.5.310.0130.07720.95
5.5.300.0130.07320.81
5.5.290.0070.08320.90
5.5.280.0230.07020.78
5.5.270.0100.09320.87
5.5.260.0170.07320.77
5.5.250.0130.04720.46
5.5.240.0000.08720.14
5.5.230.0100.05320.23
5.5.220.0100.07720.28
5.5.210.0030.08720.13
5.5.200.0100.07720.25
5.5.190.0030.08320.24
5.5.180.0100.08020.24
5.5.160.0100.04320.01
5.5.150.0030.06720.13
5.5.140.0100.06720.13
5.5.130.0000.08320.17
5.5.120.0030.08320.16
5.5.110.0030.08320.23
5.5.100.0030.07720.04
5.5.90.0000.06720.12
5.5.80.0100.07020.11
5.5.70.0030.06020.11
5.5.60.0000.08020.04
5.5.50.0070.04720.07
5.5.40.0030.07720.08
5.5.30.0000.07320.16
5.5.20.0070.08020.07
5.5.10.0030.07320.13
5.5.00.0030.07720.04
5.4.450.0070.08019.54
5.4.440.0070.07719.45
5.4.430.0070.04719.36
5.4.420.0000.05719.37
5.4.410.0200.05319.23
5.4.400.0030.07319.05
5.4.390.0100.07318.85
5.4.380.0070.03718.92
5.4.370.0100.06719.00
5.4.360.0070.07018.90
5.4.350.0000.07019.21
5.4.340.0070.07719.13
5.4.320.0100.03719.21
5.4.310.0100.08018.85
5.4.300.0030.04719.22
5.4.290.0030.05319.16
5.4.280.0070.05019.04
5.4.270.0130.07319.25
5.4.260.0130.03719.23
5.4.250.0100.06319.14
5.4.240.0100.06719.13
5.4.230.0130.07319.02
5.4.220.0030.08018.89
5.4.210.0170.05319.08
5.4.200.0170.06319.11
5.4.190.0070.07019.02
5.4.180.0170.07319.20
5.4.170.0030.08019.12
5.4.160.0030.06319.21
5.4.150.0000.08018.93
5.4.140.0070.04716.34
5.4.130.0100.06016.41
5.4.120.0100.07316.41
5.4.110.0000.07716.52
5.4.100.0070.07316.39
5.4.90.0070.07316.40
5.4.80.0130.03716.40
5.4.70.0030.05016.54
5.4.60.0070.07716.48
5.4.50.0100.06716.34
5.4.40.0070.05016.54
5.4.30.0030.06716.42
5.4.20.0030.08016.33
5.4.10.0130.03716.46
5.4.00.0130.06015.82
5.3.290.0100.03314.77
5.3.280.0170.06714.60
5.3.270.0170.07014.60
5.3.260.0030.07314.63
5.3.250.0030.06014.60
5.3.240.0000.07014.70
5.3.230.0100.08014.63
5.3.220.0000.08314.56
5.3.210.0100.06714.60
5.3.200.0130.06714.57
5.3.190.0070.07714.67
5.3.180.0100.06714.57
5.3.170.0130.07014.64
5.3.160.0070.07014.55
5.3.150.0100.07314.67
5.3.140.0100.07314.51
5.3.130.0030.05014.55
5.3.120.0100.06714.59
5.3.110.0070.07714.55
5.3.100.0000.06313.98
5.3.90.0100.06714.04
5.3.80.0100.05314.07
5.3.70.0070.03314.11
5.3.60.0100.07014.16
5.3.50.0070.06713.95
5.3.40.0030.07313.87
5.3.30.0070.07013.94
5.3.20.0070.07013.69
5.3.10.0070.07313.60
5.3.00.0070.04313.64
5.2.170.0030.06311.30
5.2.160.0070.05011.19
5.2.150.0030.06311.08
5.2.140.0000.06711.25
5.2.130.0100.05011.14
5.2.120.0070.06011.18
5.2.110.0070.05711.05
5.2.100.0000.03311.11
5.2.90.0000.03310.98
5.2.80.0070.03011.27
5.2.70.0000.03311.27
5.2.60.0030.06011.18
5.2.50.0070.05711.04
5.2.40.0030.03711.10
5.2.30.0000.06711.04
5.2.20.0000.06310.97
5.2.10.0000.03310.93
5.2.00.0030.05710.82
5.1.60.0100.03010.10
5.1.50.0000.04710.02
5.1.40.0000.0539.83
5.1.30.0070.04710.45
5.1.20.0030.06010.48
5.1.10.0000.0409.93
5.1.00.0000.05010.09
5.0.50.0030.0278.63
5.0.40.0000.0478.52
5.0.30.0000.0438.09
5.0.20.0000.0478.33
5.0.10.0030.0438.20
5.0.00.0030.0608.26
4.4.90.0000.0206.95
4.4.80.0000.0276.95
4.4.70.0030.0306.95
4.4.60.0130.0136.95
4.4.50.0000.0376.95
4.4.40.0000.0536.95
4.4.30.0030.0306.95
4.4.20.0030.0336.95
4.4.10.0030.0336.95
4.4.00.0030.0276.95
4.3.110.0000.0336.95
4.3.100.0000.0376.95
4.3.90.0070.0336.95
4.3.80.0030.0606.95
4.3.70.0000.0376.95
4.3.60.0070.0176.95
4.3.50.0030.0336.95
4.3.40.0030.0436.95
4.3.30.0000.0276.95
4.3.20.0000.0376.95
4.3.10.0030.0336.95
4.3.00.0030.0336.95

preferences:
37.88 ms | 401 KiB | 5 Q