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; while(TRUE) { var_dump($temp); if($temp >= $i[5][$tempMonth]) { $months += 1; $temp -= $i[5][$tempMonth]; } else { $days = $temp; break; } $tempMonth = $tempMonth < 10 ? $tempMonth + 1 : 0; } $years = date('Y', $second) - date('Y', $first) + $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, 1704094758);

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.68
8.3.50.0180.00721.27
8.3.40.0090.00619.14
8.3.30.0140.00020.34
8.3.20.0080.00020.46
8.3.10.0050.00322.09
8.3.00.0080.00022.36
8.2.180.0190.00317.25
8.2.170.0150.00422.96
8.2.160.0070.00722.43
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0000.00826.16
8.2.120.0040.00421.00
8.2.110.0060.00320.47
8.2.100.0060.00619.95
8.2.90.0060.00319.48
8.2.80.0040.00419.38
8.2.70.0040.00417.88
8.2.60.0080.00018.17
8.2.50.0050.00318.13
8.2.40.0000.00818.48
8.2.30.0000.00719.68
8.2.20.0030.00518.20
8.2.10.0060.00318.17
8.2.00.0000.00818.23
8.1.280.0110.00725.92
8.1.270.0040.00423.99
8.1.260.0030.00526.35
8.1.250.0090.00028.09
8.1.240.0050.00520.90
8.1.230.0030.00824.03
8.1.220.0040.00417.75
8.1.210.0000.00818.77
8.1.200.0070.00317.59
8.1.190.0000.00817.79
8.1.180.0030.00618.10
8.1.170.0000.00918.91
8.1.160.0000.00819.03
8.1.150.0040.00418.99
8.1.140.0060.00317.79
8.1.130.0070.00018.07
8.1.120.0000.00717.88
8.1.110.0000.00717.71
8.1.100.0000.00717.82
8.1.90.0000.00817.70
8.1.80.0050.00317.80
8.1.70.0000.00817.80
8.1.60.0080.00017.86
8.1.50.0030.00517.79
8.1.40.0040.00417.76
8.1.30.0000.00817.88
8.1.20.0050.00317.84
8.1.10.0040.00417.90
8.1.00.0030.00617.83
8.0.300.0060.00318.77
8.0.290.0000.00717.16
8.0.280.0070.00018.68
8.0.270.0070.00017.40
8.0.260.0000.00717.11
8.0.250.0050.00217.38
8.0.240.0000.00917.38
8.0.230.0040.00417.40
8.0.220.0000.00717.20
8.0.210.0000.00817.21
8.0.200.0030.00617.35
8.0.190.0000.00917.27
8.0.180.0030.00517.40
8.0.170.0080.00017.35
8.0.160.0070.00017.18
8.0.150.0050.00217.21
8.0.140.0000.00817.28
8.0.130.0030.00313.71
8.0.120.0080.00017.26
8.0.110.0030.00517.21
8.0.100.0080.00017.14
8.0.90.0000.00717.36
8.0.80.0000.01517.27
8.0.70.0040.00417.37
8.0.60.0000.00717.20
8.0.50.0000.00717.21
8.0.30.0100.01317.39
8.0.20.0110.01017.42
8.0.10.0040.00417.26
8.0.00.0150.00517.30
7.4.330.0000.00516.84
7.4.320.0070.00016.85
7.4.300.0030.00316.80
7.4.290.0040.00416.77
7.4.280.0000.00716.68
7.4.270.0070.00016.89
7.4.260.0000.00913.47
7.4.250.0080.00016.77
7.4.240.0050.00216.86
7.4.230.0070.00016.79
7.4.220.0070.01216.77
7.4.210.0030.01216.83
7.4.200.0070.00016.91
7.4.190.0000.00717.02
7.4.160.0070.01116.96
7.4.150.0070.01317.40
7.4.140.0100.01317.86
7.4.130.0140.00716.90
7.4.120.0100.01116.80
7.4.110.0150.00316.88
7.4.100.0130.00516.69
7.4.90.0090.01016.71
7.4.80.0150.00319.39
7.4.70.0070.01016.76
7.4.60.0110.00716.89
7.4.50.0030.00516.74
7.4.40.0150.00022.77
7.4.30.0090.00917.01
7.4.00.0030.01414.95
7.3.330.0000.00613.73
7.3.320.0030.00313.64
7.3.310.0030.00316.57
7.3.300.0030.00316.58
7.3.290.0080.00616.67
7.3.280.0110.00716.72
7.3.270.0150.00917.40
7.3.260.0100.00818.24
7.3.250.0170.00216.77
7.3.240.0140.00616.89
7.3.230.0130.00416.81
7.3.210.0060.01216.66
7.3.200.0180.00719.39
7.3.190.0150.00916.74
7.3.180.0110.00616.93
7.3.170.0040.01416.77
7.3.160.0100.00716.84
7.3.120.0030.01215.09
7.2.330.0110.00717.17
7.2.320.0120.00616.93
7.2.310.0180.00717.14
7.2.300.0060.01317.01
7.2.290.0070.01016.91
7.2.00.0000.01019.75
7.1.100.0030.01018.37
7.1.70.0000.01217.10
7.1.60.0070.01919.17
7.1.50.0150.00917.27
7.1.00.0030.03322.46
7.0.200.0000.00917.06
7.0.140.0030.07322.08
7.0.80.0000.07021.72
7.0.70.0030.04021.92
7.0.60.0000.04321.75
7.0.50.0070.07722.06
7.0.40.0030.03720.10
7.0.30.0030.04020.08
7.0.20.0070.03720.13
7.0.10.0000.07320.18
7.0.00.0030.03319.95
5.6.280.0130.06721.09
5.6.230.0130.07320.68
5.6.220.0000.04320.60
5.6.210.0000.08320.46
5.6.200.0030.08021.00
5.6.190.0030.07021.01
5.6.180.0030.07721.06
5.6.170.0070.06721.19
5.6.160.0030.03321.04
5.6.150.0030.04720.95
5.6.140.0000.06720.95
5.6.130.0000.03721.03
5.6.120.0030.03721.13
5.6.110.0030.07021.03
5.6.100.0000.04721.14
5.6.90.0030.08721.05
5.6.80.0000.03720.48
5.6.70.0070.07720.50
5.6.60.0100.03720.47
5.6.50.0030.03720.41
5.6.40.0030.08020.48
5.6.30.0030.03720.48
5.6.20.0030.07020.33
5.6.10.0030.04020.46
5.6.00.0000.03720.42
5.5.370.0000.04320.37
5.5.360.0000.04320.43
5.5.350.0000.04320.44
5.5.340.0000.04320.95
5.5.330.0070.08020.88
5.5.320.0030.04020.85
5.5.310.0030.04320.93
5.5.300.0070.04320.82
5.5.290.0030.07320.66
5.5.280.0000.04320.79
5.5.270.0070.07320.89
5.5.260.0030.03720.94
5.5.250.0030.03320.72
5.5.240.0030.06720.28
5.5.230.0000.05020.16
5.5.220.0130.03320.16
5.5.210.0070.07320.04
5.5.200.0030.08020.30
5.5.190.0030.08320.20
5.5.180.0030.05720.20
5.5.160.0000.06320.00
5.5.150.0100.03320.19
5.5.140.0030.03320.17
5.5.130.0000.04720.20
5.5.120.0030.04320.23
5.5.110.0030.03320.25
5.5.100.0000.04020.15
5.5.90.0000.03320.19
5.5.80.0030.03020.15
5.5.70.0030.04020.18
5.5.60.0100.06020.05
5.5.50.0100.06720.12
5.5.40.0000.04020.18
5.5.30.0030.07020.15
5.5.20.0030.06019.97
5.5.10.0100.04320.08
5.5.00.0000.03720.13
5.4.450.0070.07019.51
5.4.440.0030.03319.57
5.4.430.0000.05019.35
5.4.420.0030.05319.45
5.4.410.0130.07019.34
5.4.400.0030.05019.13
5.4.390.0030.03318.88
5.4.380.0000.07719.18
5.4.370.0000.04718.86
5.4.360.0030.03719.09
5.4.350.0070.03019.16
5.4.340.0000.04718.82
5.4.320.0030.05719.13
5.4.310.0030.06719.18
5.4.300.0070.05319.04
5.4.290.0000.03319.18
5.4.280.0100.06019.23
5.4.270.0030.03319.12
5.4.260.0030.04019.03
5.4.250.0030.03719.12
5.4.240.0030.05719.03
5.4.230.0000.07719.04
5.4.220.0000.07719.20
5.4.210.0100.02719.08
5.4.200.0000.03319.05
5.4.190.0000.04318.93
5.4.180.0030.03018.84
5.4.170.0100.06319.01
5.4.160.0070.03319.10
5.4.150.0030.05018.98
5.4.140.0070.03716.50
5.4.130.0000.03716.39
5.4.120.0030.04016.46
5.4.110.0030.07016.56
5.4.100.0030.03016.49
5.4.90.0030.03316.32
5.4.80.0000.03716.57
5.4.70.0000.04016.52
5.4.60.0000.05016.47
5.4.50.0030.04716.37
5.4.40.0030.04316.53
5.4.30.0000.06716.40
5.4.20.0000.07316.46
5.4.10.0000.04716.40
5.4.00.0030.03315.88
5.3.290.0030.03714.67
5.3.280.0030.03714.67
5.3.270.0000.04014.72
5.3.260.0070.04314.63
5.3.250.0070.03314.55
5.3.240.0000.06014.68
5.3.230.0000.04014.60
5.3.220.0000.03714.64
5.3.210.0000.05014.69
5.3.200.0070.06014.66
5.3.190.0000.04014.69
5.3.180.0030.06014.59
5.3.170.0070.03314.72
5.3.160.0070.07014.72
5.3.150.0030.07714.54
5.3.140.0000.07714.56
5.3.130.0070.07714.63
5.3.120.0070.06314.55
5.3.110.0130.05714.66
5.3.100.0100.03014.19
5.3.90.0030.04013.96
5.3.80.0070.04714.04
5.3.70.0070.03314.09
5.3.60.0030.03714.11
5.3.50.0000.06313.96
5.3.40.0000.04013.98
5.3.30.0000.05013.92
5.3.20.0030.04713.77
5.3.10.0000.03013.66
5.3.00.0000.03313.77
5.2.170.0100.02311.54
5.2.160.0000.03011.54
5.2.150.0100.03011.52
5.2.140.0000.06311.52
5.2.130.0030.02711.52
5.2.120.0030.02711.52
5.2.110.0000.07011.52
5.2.100.0070.06011.52
5.2.90.0000.03011.52
5.2.80.0030.03711.52
5.2.70.0000.02711.52
5.2.60.0000.02711.52
5.2.50.0000.02711.52
5.2.40.0000.03011.52
5.2.30.0000.06011.52
5.2.20.0070.05711.52
5.2.10.0000.02711.52
5.2.00.0000.03011.52
5.1.60.0000.02011.52
5.1.50.0000.02011.52
5.1.40.0030.04711.52
5.1.30.0030.04311.52
5.1.20.0030.02311.52
5.1.10.0000.04711.52
5.1.00.0000.05711.52
5.0.50.0030.03311.52
5.0.40.0000.02011.52
5.0.30.0000.03311.52
5.0.20.0000.03011.52
5.0.10.0070.03311.52
5.0.00.0030.04311.52
4.4.90.0030.01011.52
4.4.80.0000.01711.52
4.4.70.0000.03311.52
4.4.60.0030.02311.52
4.4.50.0000.02011.52
4.4.40.0000.05711.52
4.4.30.0000.03311.52
4.4.20.0000.01711.52
4.4.10.0000.01311.52
4.4.00.0070.05311.52
4.3.110.0030.02011.52
4.3.100.0000.03311.52
4.3.90.0000.03311.52
4.3.80.0030.02311.52
4.3.70.0000.01311.52
4.3.60.0000.02311.52
4.3.50.0000.03711.52
4.3.40.0000.05311.52
4.3.30.0000.03311.52
4.3.20.0000.02311.52
4.3.10.0070.02011.52
4.3.00.0000.02311.52

preferences:
41.37 ms | 401 KiB | 5 Q