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; 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; } $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, 1704094757);

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.40.0090.00919.02
8.3.30.0100.00320.34
8.3.20.0040.00420.38
8.3.10.0040.00422.09
8.3.00.0030.00522.39
8.2.170.0040.01122.96
8.2.160.0080.00622.11
8.2.150.0080.00024.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0000.00721.06
8.2.110.0030.00721.17
8.2.100.0060.00619.70
8.2.90.0040.00419.43
8.2.80.0060.00319.38
8.2.70.0000.00918.00
8.2.60.0040.00418.18
8.2.50.0030.00518.07
8.2.40.0090.00018.46
8.2.30.0040.00419.47
8.2.20.0020.00518.06
8.2.10.0040.00418.10
8.2.00.0040.00418.11
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0000.00828.09
8.1.240.0040.00421.40
8.1.230.0060.00620.85
8.1.220.0030.00517.74
8.1.210.0030.00518.77
8.1.200.0030.00617.60
8.1.190.0000.00817.75
8.1.180.0000.00818.10
8.1.170.0080.00018.83
8.1.160.0000.00818.97
8.1.150.0040.00418.93
8.1.140.0040.00417.66
8.1.130.0000.00718.04
8.1.120.0000.00717.71
8.1.110.0000.00717.63
8.1.100.0040.00417.71
8.1.90.0020.00517.71
8.1.80.0050.00217.65
8.1.70.0000.00717.68
8.1.60.0050.00317.83
8.1.50.0040.00417.63
8.1.40.0000.00917.80
8.1.30.0040.00417.91
8.1.20.0000.00817.85
8.1.10.0000.00817.74
8.1.00.0000.00817.70
8.0.300.0040.00418.77
8.0.290.0040.00417.43
8.0.280.0040.00418.70
8.0.270.0050.00317.42
8.0.260.0000.00817.13
8.0.250.0070.00017.20
8.0.240.0060.00317.19
8.0.230.0000.00817.19
8.0.220.0020.00517.27
8.0.210.0030.00317.29
8.0.200.0000.00717.26
8.0.190.0040.00417.36
8.0.180.0000.00717.20
8.0.170.0000.00817.17
8.0.160.0050.00317.24
8.0.150.0030.00317.26
8.0.140.0050.00217.09
8.0.130.0000.00613.58
8.0.120.0000.00817.17
8.0.110.0040.00417.29
8.0.100.0040.00417.04
8.0.90.0030.00517.07
8.0.80.0120.00617.26
8.0.70.0040.00417.18
8.0.60.0000.00817.14
8.0.50.0070.00017.28
8.0.30.0140.00717.18
8.0.20.0050.01417.49
8.0.10.0000.00717.36
8.0.00.0130.01017.00
7.4.330.0000.00516.72
7.4.320.0060.00016.82
7.4.300.0060.00016.72
7.4.290.0030.00316.72
7.4.280.0070.00016.74
7.4.270.0030.00316.76
7.4.260.0000.00513.40
7.4.250.0090.00016.68
7.4.240.0040.00316.77
7.4.230.0020.00516.81
7.4.220.0090.00916.85
7.4.210.0060.00916.81
7.4.200.0040.00316.71
7.4.190.0030.00317.00
7.4.160.0150.00716.72
7.4.150.0080.01917.40
7.4.140.0100.01017.86
7.4.130.0150.01716.79
7.4.120.0080.00816.70
7.4.110.0090.00616.78
7.4.100.0180.00316.54
7.4.90.0130.00316.76
7.4.80.0070.01019.39
7.4.70.0130.00316.84
7.4.60.0000.01716.80
7.4.50.0000.00916.61
7.4.40.0020.00822.77
7.4.30.0080.00816.70
7.4.00.0070.00915.09
7.3.330.0000.00613.42
7.3.320.0000.00513.57
7.3.310.0040.00216.59
7.3.300.0040.00416.56
7.3.290.0030.01016.55
7.3.280.0100.00816.58
7.3.270.0070.01017.40
7.3.260.0090.01018.24
7.3.250.0060.01116.91
7.3.240.0030.01416.77
7.3.230.0030.01316.74
7.3.210.0130.00316.81
7.3.200.0120.00919.39
7.3.190.0100.01016.56
7.3.180.0040.01216.70
7.3.170.0060.01016.66
7.3.160.0070.01016.95
7.3.120.0070.01015.18
7.3.110.0030.01015.13
7.3.100.0060.00915.00
7.3.90.0090.00615.10
7.3.80.0050.00815.05
7.3.70.0050.00914.81
7.3.60.0000.01515.08
7.3.50.0050.01015.15
7.3.40.0050.01014.98
7.3.30.0060.00615.10
7.3.20.0050.00816.91
7.3.10.0030.01017.07
7.3.00.0080.00816.82
7.2.330.0150.00317.04
7.2.320.0090.01517.11
7.2.310.0090.00917.12
7.2.300.0070.01117.07
7.2.290.0080.00817.03
7.2.250.0070.00915.21
7.2.240.0050.01415.24
7.2.230.0030.01315.42
7.2.220.0030.00815.30
7.2.210.0090.00715.19
7.2.200.0020.00915.39
7.2.190.0070.00715.40
7.2.180.0040.01315.26
7.2.170.0060.00815.12
7.2.60.0070.00716.84
7.2.50.0070.00717.22
7.1.330.0060.00915.83
7.1.320.0030.01216.06
7.1.310.0050.01016.14
7.1.300.0080.00616.02
7.1.290.0090.00516.09
7.1.280.0060.00616.07
7.1.270.0020.01315.94
7.1.260.0030.01015.75
7.1.200.0040.00715.86
7.1.70.0080.00417.07
7.1.60.0090.01519.17
7.1.50.0080.01217.29
7.1.00.0000.03722.30
7.0.200.0100.00717.00
7.0.140.0030.07322.18
7.0.100.0000.07319.94
7.0.90.0100.08019.84
7.0.80.0000.05719.91
7.0.70.0100.06719.98
7.0.60.0100.04020.05
7.0.50.0030.07720.38
7.0.40.0130.06020.09
7.0.30.0130.07019.96
7.0.20.0070.04720.13
7.0.10.0070.04020.08
7.0.00.0000.07719.99
5.6.280.0030.07320.89
5.6.250.0030.08720.50
5.6.240.0030.07320.48
5.6.230.0200.05320.45
5.6.220.0170.07320.58
5.6.210.0030.06720.44
5.6.200.0200.07021.13
5.6.190.0070.08321.12
5.6.180.0070.08320.97
5.6.170.0030.06321.11
5.6.160.0130.07021.04
5.6.150.0030.05321.13
5.6.140.0070.04721.03
5.6.130.0100.03721.09
5.6.120.0000.09321.05
5.6.110.0070.08321.15
5.6.100.0170.06321.05
5.6.90.0130.06321.03
5.6.80.0170.06020.36
5.6.70.0170.05320.44
5.6.60.0100.08020.43
5.6.50.0100.04020.51
5.6.40.0070.05020.51
5.6.30.0100.03720.34
5.6.20.0070.05320.46
5.6.10.0170.07020.42
5.6.00.0030.08020.42
5.5.380.0170.07320.41
5.5.370.0070.06020.38
5.5.360.0000.06020.37
5.5.350.0030.09020.43
5.5.340.0130.07320.66
5.5.330.0130.08320.94
5.5.320.0130.05020.92
5.5.310.0100.08020.80
5.5.300.0000.06320.85
5.5.290.0100.07720.85
5.5.280.0030.08320.92
5.5.270.0030.08020.94
5.5.260.0100.06720.81
5.5.250.0070.04320.66
5.5.240.0130.07320.04
5.5.230.0130.08020.27
5.5.220.0100.08020.31
5.5.210.0070.05720.27
5.5.200.0070.07320.02
5.5.190.0030.06320.11
5.5.180.0130.07720.24
5.5.160.0070.07720.18
5.5.150.0030.06020.13
5.5.140.0030.08320.27
5.5.130.0100.06720.14
5.5.120.0070.08020.23
5.5.110.0100.07320.27
5.5.100.0030.08020.19
5.5.90.0070.06720.15
5.5.80.0200.05020.11
5.5.70.0100.08319.94
5.5.60.0070.05020.11
5.5.50.0030.08020.08
5.5.40.0100.04320.12
5.5.30.0100.08019.95
5.5.20.0070.07320.07
5.5.10.0000.05020.11
5.5.00.0070.04320.06
5.4.450.0070.06719.51
5.4.440.0030.06019.45
5.4.430.0170.05719.49
5.4.420.0130.03719.46
5.4.410.0030.07719.32
5.4.400.0030.07718.88
5.4.390.0130.08319.12
5.4.380.0070.07319.03
5.4.370.0070.04318.84
5.4.360.0070.08019.21
5.4.350.0070.04318.87
5.4.340.0000.05018.91
5.4.320.0100.07319.16
5.4.310.0070.07319.12
5.4.300.0070.05018.90
5.4.290.0070.07319.22
5.4.280.0100.07319.04
5.4.270.0030.07019.13
5.4.260.0070.05318.90
5.4.250.0070.08019.20
5.4.240.0100.07719.13
5.4.230.0000.07019.19
5.4.220.0200.04319.02
5.4.210.0030.06719.11
5.4.200.0030.07719.08
5.4.190.0100.04019.15
5.4.180.0070.06319.21
5.4.170.0030.08719.13
5.4.160.0130.05019.19
5.4.150.0070.08019.12
5.4.140.0070.07716.34
5.4.130.0030.04316.31
5.4.120.0100.06716.47
5.4.110.0030.05716.40
5.4.100.0100.07316.41
5.4.90.0070.06716.41
5.4.80.0100.06716.51
5.4.70.0030.07016.55
5.4.60.0100.05316.48
5.4.50.0100.06716.26
5.4.40.0000.07016.37
5.4.30.0070.07316.49
5.4.20.0070.07316.29
5.4.10.0070.04316.46
5.4.00.0070.04015.85
5.3.290.0070.05314.75
5.3.280.0070.07314.63
5.3.270.0070.08014.75
5.3.260.0070.08014.64
5.3.250.0000.08014.73
5.3.240.0030.05714.72
5.3.230.0100.07714.54
5.3.220.0070.08014.56
5.3.210.0070.08314.64
5.3.200.0000.07014.73
5.3.190.0130.06014.72
5.3.180.0100.07314.51
5.3.170.0100.06714.64
5.3.160.0070.04714.64
5.3.150.0100.04014.50
5.3.140.0070.08014.72
5.3.130.0170.06314.54
5.3.120.0030.08014.58
5.3.110.0070.05714.50
5.3.100.0070.07014.02
5.3.90.0170.06714.16
5.3.80.0070.06014.06
5.3.70.0100.07014.07
5.3.60.0030.05013.96
5.3.50.0000.08014.08
5.3.40.0100.07014.00
5.3.30.0100.07014.05
5.3.20.0030.07013.70
5.3.10.0130.06313.60
5.3.00.0100.07313.76
5.2.170.0070.03711.94
5.2.160.0000.06311.94
5.2.150.0030.06311.94
5.2.140.0100.06011.94
5.2.130.0030.06011.94
5.2.120.0030.06011.94
5.2.110.0070.06311.94
5.2.100.0070.06011.94
5.2.90.0030.04711.94
5.2.80.0130.05311.94
5.2.70.0030.07011.94
5.2.60.0130.04711.94
5.2.50.0070.07011.94
5.2.40.0000.06311.94
5.2.30.0000.04011.94
5.2.20.0100.02311.94
5.2.10.0070.05711.94
5.2.00.0070.04311.94
5.1.60.0030.03311.94
5.1.50.0170.03011.94
5.1.40.0100.05011.94
5.1.30.0170.04711.94
5.1.20.0070.04311.94
5.1.10.0100.05311.94
5.1.00.0070.04711.94
5.0.50.0070.04011.94
5.0.40.0070.04311.94
5.0.30.0070.05311.94
5.0.20.0100.03311.94
5.0.10.0030.03011.94
5.0.00.0000.05711.94
4.4.90.0070.03311.94
4.4.80.0030.03311.94
4.4.70.0000.03711.94
4.4.60.0000.03311.94
4.4.50.0070.02011.94
4.4.40.0030.04011.94
4.4.30.0000.03011.94
4.4.20.0000.03311.94
4.4.10.0000.03311.94
4.4.00.0070.04311.94
4.3.110.0000.03711.94
4.3.100.0130.02011.94
4.3.90.0030.03011.94
4.3.80.0070.05011.94
4.3.70.0030.03711.94
4.3.60.0000.03011.94
4.3.50.0100.02011.94
4.3.40.0070.04011.94
4.3.30.0000.03711.94
4.3.20.0030.03711.94
4.3.10.0000.03711.94
4.3.00.0030.03311.94

preferences:
50.03 ms | 400 KiB | 5 Q