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); $years = floor($inbetween / $i[0] / $i[0] / $i[1] % $i[4]); echo $years; $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; } $hours = floor($inbetween / $i[0] / $i[0] % $i[1]); $minutes = floor($inbetween / $i[0] % $i[0]); $seconds = $inbetween % $i[0]; return $months . " months " . $days . " days " . $hours . " hours " . $minutes . " minutes " . $seconds . " seconds";; } 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.60.0110.01118.45
8.3.50.0240.00721.33
8.3.40.0040.01119.04
8.3.30.0100.00320.34
8.3.20.0000.00720.43
8.3.10.0050.00322.22
8.3.00.0040.00422.46
8.2.180.0110.01117.00
8.2.170.0070.00722.96
8.2.160.0070.00722.38
8.2.150.0050.00324.18
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0060.00321.00
8.2.110.0030.00619.43
8.2.100.0080.00318.09
8.2.90.0040.00419.66
8.2.80.0040.00419.41
8.2.70.0040.00418.00
8.2.60.0090.00018.29
8.2.50.0000.00818.07
8.2.40.0000.00818.40
8.2.30.0080.00019.53
8.2.20.0040.00418.11
8.2.10.0080.00018.13
8.2.00.0080.00018.04
8.1.280.0070.00725.92
8.1.270.0040.00423.99
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00723.86
8.1.230.0040.00820.88
8.1.220.0000.00819.02
8.1.210.0040.00418.77
8.1.200.0030.00617.60
8.1.190.0030.00517.79
8.1.180.0060.00318.10
8.1.170.0040.00418.81
8.1.160.0050.00319.00
8.1.150.0000.01018.99
8.1.140.0040.00417.71
8.1.130.0040.00418.01
8.1.120.0050.00317.72
8.1.110.0000.00717.70
8.1.100.0040.00417.80
8.1.90.0020.00517.84
8.1.80.0040.00317.82
8.1.70.0030.00517.71
8.1.60.0030.00517.86
8.1.50.0000.00917.86
8.1.40.0000.00817.72
8.1.30.0000.00817.86
8.1.20.0080.00017.96
8.1.10.0020.00517.83
8.1.00.0030.00617.72
8.0.300.0070.00018.77
8.0.290.0040.00417.55
8.0.280.0000.00718.66
8.0.270.0040.00417.49
8.0.260.0030.00517.22
8.0.250.0000.00717.34
8.0.240.0000.00817.27
8.0.230.0050.00317.32
8.0.220.0030.00317.27
8.0.210.0000.00717.32
8.0.200.0070.00017.25
8.0.190.0040.00417.25
8.0.180.0050.00317.32
8.0.170.0000.00717.32
8.0.160.0000.00717.30
8.0.150.0030.00317.29
8.0.140.0040.00417.30
8.0.130.0000.00613.71
8.0.120.0080.00017.33
8.0.110.0000.00817.30
8.0.100.0080.00017.09
8.0.90.0070.00017.13
8.0.80.0000.01517.23
8.0.70.0020.00517.20
8.0.60.0040.00417.29
8.0.50.0050.00217.18
8.0.30.0120.00817.40
8.0.20.0120.00717.43
8.0.10.0030.00517.35
8.0.00.0080.01317.28
7.4.330.0000.00516.91
7.4.320.0040.00416.79
7.4.300.0060.00016.85
7.4.290.0040.00416.72
7.4.280.0040.00416.64
7.4.270.0030.00516.90
7.4.260.0040.00413.45
7.4.250.0040.00416.74
7.4.240.0040.00416.77
7.4.230.0000.00716.71
7.4.220.0130.00516.88
7.4.210.0050.00916.79
7.4.200.0030.00316.64
7.4.190.0070.00016.96
7.4.160.0070.01416.79
7.4.150.0100.01317.40
7.4.140.0120.00717.86
7.4.130.0100.01016.81
7.4.120.0120.00516.77
7.4.110.0100.00616.82
7.4.100.0130.00616.92
7.4.90.0100.00716.63
7.4.80.0150.00819.39
7.4.70.0030.01516.84
7.4.60.0120.00416.66
7.4.50.0080.00016.88
7.4.40.0070.01022.77
7.4.30.0120.00416.92
7.4.10.0100.00715.29
7.4.00.0060.01115.18
7.3.330.0030.00313.63
7.3.320.0050.00013.64
7.3.310.0000.00716.51
7.3.300.0070.00016.63
7.3.290.0070.00716.63
7.3.280.0120.00716.68
7.3.270.0120.00817.40
7.3.260.0070.01118.24
7.3.250.0080.01016.79
7.3.240.0130.01016.78
7.3.230.0130.00316.64
7.3.210.0030.01516.84
7.3.200.0110.01219.39
7.3.190.0100.01316.98
7.3.180.0060.00916.79
7.3.170.0130.00316.72
7.3.160.0040.01216.82
7.3.130.0070.01115.11
7.3.120.0080.00715.09
7.3.110.0110.00615.04
7.3.100.0060.01015.18
7.3.90.0080.00614.99
7.3.80.0050.01115.21
7.3.70.0050.00915.14
7.3.60.0050.00515.15
7.3.50.0070.00615.00
7.3.40.0050.01015.03
7.3.30.0030.00714.90
7.3.20.0060.00817.00
7.3.10.0070.00816.83
7.3.00.0060.00816.87
7.2.330.0090.00917.02
7.2.320.0130.01017.13
7.2.310.0170.00616.98
7.2.300.0150.00816.98
7.2.290.0060.01216.90
7.2.260.0040.01215.48
7.2.250.0030.01315.24
7.2.240.0120.00515.51
7.2.230.0070.00915.32
7.2.220.0050.00815.34
7.2.210.0000.01215.36
7.2.200.0050.00915.43
7.2.190.0030.01115.45
7.2.180.0050.00815.35
7.2.170.0050.00815.39
7.2.160.0030.00815.21
7.2.150.0030.01117.07
7.2.140.0080.00617.07
7.2.130.0070.00617.35
7.2.120.0080.00617.12
7.2.110.0070.00917.08
7.2.100.0100.00517.17
7.2.90.0080.00817.09
7.2.80.0080.00617.25
7.2.70.0050.00817.13
7.2.60.0080.00717.15
7.2.50.0130.00616.99
7.2.40.0090.00617.03
7.2.30.0080.00817.03
7.2.20.0040.01017.20
7.2.10.0070.00717.07
7.2.00.0040.01117.28
7.1.330.0050.01015.98
7.1.320.0100.00516.15
7.1.310.0020.01016.06
7.1.300.0000.01016.12
7.1.290.0050.00716.20
7.1.280.0080.00516.04
7.1.270.0080.00516.01
7.1.260.0070.00915.84
7.1.250.0090.00715.91
7.1.240.0060.00616.17
7.1.230.0050.01015.96
7.1.220.0060.00816.02
7.1.210.0030.01016.01
7.1.200.0040.00816.08
7.1.190.0060.00815.99
7.1.180.0060.00716.00
7.1.170.0090.00316.02
7.1.160.0070.00516.14
7.1.150.0060.00616.09
7.1.140.0040.00516.14
7.1.130.0030.00816.20
7.1.120.0070.00315.98
7.1.110.0060.00416.04
7.1.100.0080.00516.04
7.1.90.0050.00916.18
7.1.80.0060.00615.99
7.1.70.0060.00616.45
7.1.60.0080.01017.08
7.1.50.0040.01116.35
7.1.40.0050.00916.04
7.1.30.0080.00316.03
7.1.20.0040.00716.04
7.1.10.0030.01015.81
7.1.00.0040.01618.12
7.0.330.0100.00515.56
7.0.320.0060.00515.65
7.0.310.0050.00515.44
7.0.300.0060.00615.49
7.0.290.0010.00715.62
7.0.280.0050.00615.59
7.0.270.0040.00615.39
7.0.260.0100.00215.55
7.0.250.0030.01115.57
7.0.240.0070.00715.45
7.0.230.0030.00915.56
7.0.220.0040.00615.59
7.0.210.0050.00915.64
7.0.200.0060.00616.19
7.0.190.0020.01015.62
7.0.180.0030.01115.46
7.0.170.0020.01115.56
7.0.160.0020.01115.63
7.0.150.0000.01615.67
7.0.140.0090.02817.71
7.0.130.0000.01315.67
7.0.120.0040.01115.62
7.0.110.0070.00515.71
7.0.100.0060.00815.54
7.0.90.0060.00815.63
7.0.80.0040.02017.05
7.0.70.0160.02517.09
7.0.60.0200.02516.99
7.0.50.0060.01917.24
7.0.40.0010.02815.78
7.0.30.0040.01915.80
7.0.20.0060.03615.79
7.0.10.0040.02315.84
7.0.00.0060.01915.79
5.6.400.0050.00614.53
5.6.390.0070.00514.63
5.6.380.0060.00514.71
5.6.370.0070.00714.95
5.6.360.0050.00814.59
5.6.350.0030.00814.78
5.6.340.0080.00314.66
5.6.330.0070.00414.65
5.6.320.0010.01014.45
5.6.310.0030.01014.39
5.6.300.0050.01214.58
5.6.290.0070.00714.47
5.6.280.0050.03016.74
5.6.270.0050.00614.70
5.6.260.0070.00914.69
5.6.250.0030.01314.73
5.6.240.0070.00814.62
5.6.230.0040.01916.60
5.6.220.0060.02816.57
5.6.210.0050.02416.59
5.6.200.0050.03416.63
5.6.190.0060.02716.81
5.6.180.0060.02416.75
5.6.170.0030.02016.78
5.6.160.0100.02916.73
5.6.150.0090.03016.65
5.6.140.0050.03416.73
5.6.130.0050.02016.94
5.6.120.0050.03216.84
5.6.110.0050.02916.79
5.6.100.0030.02416.78
5.6.90.0070.01916.69
5.6.80.0130.02516.48
5.6.70.0070.02816.45
5.6.60.0090.03016.49
5.6.50.0110.02716.47
5.6.40.0050.02816.57
5.6.30.0030.03116.54
5.6.20.0090.02716.50
5.6.10.0060.03316.45
5.6.00.0070.03016.59
5.5.380.0060.00314.59
5.5.370.0110.02716.41
5.5.360.0040.02016.61
5.5.350.0100.01816.45
5.5.340.0060.03016.74
5.5.330.0050.03016.70
5.5.320.0060.02516.74
5.5.310.0050.01816.68
5.5.300.0070.01916.72
5.5.290.0090.03016.74
5.5.280.0070.02116.50
5.5.270.0080.03316.63
5.5.260.0050.03016.63
5.5.250.0090.03016.68
5.5.240.0040.02616.49
5.5.230.0080.02216.52
5.5.220.0070.02916.35
5.5.210.0080.02916.55
5.5.200.0090.03116.39
5.5.190.0100.02816.22
5.5.180.0060.03516.33
5.5.170.0070.01014.46
5.5.160.0060.03216.40
5.5.150.0070.02616.28
5.5.140.0040.02816.31
5.5.130.0030.02916.51
5.5.120.0070.02716.43
5.5.110.0060.02816.42
5.5.100.0020.02116.27
5.5.90.0050.03216.25
5.5.80.0060.02416.36
5.5.70.0050.02416.32
5.5.60.0040.02816.31
5.5.50.0110.02516.33
5.5.40.0050.03416.35
5.5.30.0090.03016.32
5.5.20.0060.03216.41
5.5.10.0050.03216.32
5.5.00.0010.03416.25
5.4.450.0060.03214.56
5.4.440.0040.03214.51
5.4.430.0060.02914.57
5.4.420.0050.02014.58
5.4.410.0080.02614.35
5.4.400.0050.02114.42
5.4.390.0080.02814.33
5.4.380.0030.02014.38
5.4.370.0070.01914.36
5.4.360.0050.03114.25
5.4.350.0100.02114.38
5.4.340.0040.03114.38
5.4.330.0040.00711.89
5.4.320.0050.02214.33
5.4.310.0040.03014.25
5.4.300.0040.03014.23
5.4.290.0080.02914.40
5.4.280.0050.03014.25
5.4.270.0050.03014.36
5.4.260.0040.01814.19
5.4.250.0040.02814.25
5.4.240.0050.03014.24
5.4.230.0040.02614.42
5.4.220.0090.02414.16
5.4.210.0050.02814.24
5.4.200.0050.02914.26
5.4.190.0060.03114.25
5.4.180.0060.02614.41
5.4.170.0060.03014.39
5.4.160.0040.02014.35
5.4.150.0050.02314.27
5.4.140.0030.02113.49
5.4.130.0090.02413.50
5.4.120.0030.02513.50
5.4.110.0050.03113.50
5.4.100.0010.02013.56
5.4.90.0020.02413.45
5.4.80.0080.02413.51
5.4.70.0040.02813.53
5.4.60.0040.03013.39
5.4.50.0080.02513.46
5.4.40.0030.03013.44
5.4.30.0060.02113.41
5.4.20.0090.02313.51
5.4.10.0040.03113.40
5.4.00.0100.02513.21
5.3.290.0060.02712.72
5.3.280.0040.01812.69
5.3.270.0030.02812.73
5.3.260.0050.01912.75
5.3.250.0040.01612.65
5.3.240.0050.02912.67
5.3.230.0050.02712.63
5.3.220.0020.02212.67
5.3.210.0040.02712.68
5.3.200.0080.01912.69
5.3.190.0070.02812.58
5.3.180.0020.02712.73
5.3.170.0040.02312.65
5.3.160.0060.01712.67
5.3.150.0060.01912.71
5.3.140.0030.03012.67
5.3.130.0040.01912.65
5.3.120.0060.01712.66
5.3.110.0090.02712.66
5.3.100.0060.02612.53
5.3.90.0070.01912.51
5.3.80.0050.02712.48
5.3.70.0090.02712.50
5.3.60.0040.02912.52
5.3.50.0050.02612.49
5.3.40.0040.02612.41
5.3.30.0030.03012.39
5.3.20.0070.01412.26
5.3.10.0010.01812.35
5.3.00.0050.01612.31
5.2.170.0070.04311.22
5.2.160.0030.06311.29
5.2.150.0070.04011.19
5.2.140.0070.04011.25
5.2.130.0030.04011.11
5.2.120.0000.03311.02
5.2.110.0000.03711.18
5.2.100.0030.03011.18
5.2.90.0000.03311.13
5.2.80.0070.04011.19
5.2.70.0100.06311.24
5.2.60.0070.06010.97
5.2.50.0030.04311.09
5.2.40.0070.05711.08
5.2.30.0100.06011.10
5.2.20.0030.04310.98
5.2.10.0070.05310.91
5.2.00.0070.04710.64
5.1.60.0070.04710.02
5.1.50.0070.05010.07
5.1.40.0100.03710.11
5.1.30.0070.03010.29
5.1.20.0070.04710.49
5.1.10.0030.0379.93
5.1.00.0000.04010.09
5.0.50.0070.0338.64
5.0.40.0070.0378.43
5.0.30.0000.0678.32
5.0.20.0000.0238.23
5.0.10.0070.0378.05
5.0.00.0030.0708.30
4.4.90.0030.0307.34
4.4.80.0030.0337.34
4.4.70.0030.0137.34
4.4.60.0030.0137.34
4.4.50.0000.0237.34
4.4.40.0070.0307.34
4.4.30.0000.0407.34
4.4.20.0000.0237.34
4.4.10.0070.0277.34
4.4.00.0000.0377.34
4.3.110.0030.0377.34
4.3.100.0000.0337.34
4.3.90.0100.0277.34
4.3.80.0000.0377.34
4.3.70.0000.0337.34
4.3.60.0070.0137.34
4.3.50.0000.0207.34
4.3.40.0070.0437.34
4.3.30.0000.0337.34
4.3.20.0030.0337.34
4.3.10.0000.0377.34
4.3.00.0000.0337.34

preferences:
52.09 ms | 401 KiB | 5 Q