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]) >= $i[4] ? 1 : 0; 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.70.0110.00717.13
8.3.60.0070.01118.80
8.3.50.0200.00521.21
8.3.40.0000.01419.05
8.3.30.0070.00720.29
8.3.20.0040.00420.34
8.3.10.0000.00822.17
8.3.00.0040.00422.46
8.2.180.0140.00716.75
8.2.170.0120.00322.96
8.2.160.0070.00722.41
8.2.150.0130.00324.18
8.2.140.0060.00324.66
8.2.130.0030.00626.16
8.2.120.0040.00421.11
8.2.110.0050.00519.49
8.2.100.0090.00318.21
8.2.90.0060.00319.51
8.2.80.0040.00419.39
8.2.70.0000.00817.85
8.2.60.0000.00818.04
8.2.50.0030.00618.07
8.2.40.0050.00318.46
8.2.30.0030.00519.61
8.2.20.0030.00518.15
8.2.10.0080.00018.24
8.2.00.0000.00818.04
8.1.280.0070.01425.92
8.1.270.0060.00323.99
8.1.260.0000.00826.35
8.1.250.0070.00028.09
8.1.240.0140.00721.48
8.1.230.0110.00020.97
8.1.220.0040.00417.91
8.1.210.0000.00818.92
8.1.200.0030.00717.60
8.1.190.0000.00817.64
8.1.180.0000.00818.10
8.1.170.0030.00618.71
8.1.160.0000.00718.99
8.1.150.0000.00818.90
8.1.140.0080.00017.71
8.1.130.0000.00718.00
8.1.120.0000.00717.80
8.1.110.0040.00417.70
8.1.100.0040.00417.84
8.1.90.0030.00517.79
8.1.80.0030.00417.88
8.1.70.0000.00817.68
8.1.60.0000.00917.79
8.1.50.0000.00817.72
8.1.40.0040.00417.68
8.1.30.0030.00517.89
8.1.20.0050.00317.96
8.1.10.0030.00517.84
8.1.00.0040.00417.80
8.0.300.0000.00720.32
8.0.290.0040.00417.29
8.0.280.0030.00318.68
8.0.270.0050.00318.38
8.0.260.0040.00417.19
8.0.250.0050.00217.39
8.0.240.0000.00817.31
8.0.230.0040.00417.23
8.0.220.0000.00717.27
8.0.210.0050.00217.27
8.0.200.0000.00817.27
8.0.190.0050.00317.40
8.0.180.0000.00817.25
8.0.170.0000.00717.22
8.0.160.0040.00417.34
8.0.150.0030.00517.30
8.0.140.0040.00417.28
8.0.130.0060.00013.65
8.0.120.0060.00317.30
8.0.110.0070.00017.32
8.0.100.0050.00317.21
8.0.90.0040.00417.13
8.0.80.0030.01217.25
8.0.70.0030.00517.33
8.0.60.0050.00217.20
8.0.50.0040.00417.20
8.0.30.0170.00617.42
8.0.20.0150.00517.41
8.0.10.0040.00417.40
8.0.00.0080.01117.21
7.4.330.0000.00516.79
7.4.320.0050.00216.90
7.4.300.0000.00716.89
7.4.290.0030.00316.87
7.4.280.0070.00016.80
7.4.270.0030.00616.81
7.4.260.0000.00613.50
7.4.250.0030.00516.66
7.4.240.0020.00516.81
7.4.230.0030.00516.87
7.4.220.0060.01316.83
7.4.210.0080.00816.79
7.4.200.0030.00316.88
7.4.190.0030.00316.89
7.4.160.0170.00316.80
7.4.150.0100.00717.40
7.4.140.0080.00917.86
7.4.130.0070.01316.93
7.4.120.0090.00916.76
7.4.110.0070.01116.98
7.4.100.0130.00516.80
7.4.90.0140.00316.79
7.4.80.0030.01317.02
7.4.70.0170.00416.89
7.4.60.0120.00516.77
7.4.50.0080.00016.94
7.4.40.0030.01322.77
7.4.30.0090.00617.04
7.4.00.0120.00015.13
7.3.330.0050.00013.58
7.3.320.0030.00313.72
7.3.310.0030.00316.55
7.3.300.0030.00616.52
7.3.290.0060.00816.70
7.3.280.0100.00616.65
7.3.270.0120.00517.40
7.3.260.0060.01218.24
7.3.250.0080.01316.80
7.3.240.0070.01116.77
7.3.230.0090.00816.84
7.3.210.0130.00616.71
7.3.200.0110.00719.39
7.3.190.0100.00716.94
7.3.180.0060.00916.86
7.3.170.0130.00316.69
7.3.160.0110.00516.77
7.3.120.0030.01215.21
7.3.10.0120.00616.80
7.3.00.0060.00616.87
7.2.330.0120.00616.84
7.2.320.0090.00917.15
7.2.310.0100.00717.16
7.2.300.0100.00717.23
7.2.290.0030.01317.13
7.2.130.0060.01116.88
7.2.120.0110.00317.10
7.2.110.0090.00317.10
7.2.100.0070.00816.80
7.2.90.0040.01317.04
7.2.80.0080.00817.00
7.2.70.0060.00817.02
7.2.60.0020.01217.19
7.2.50.0050.01316.82
7.2.40.0060.01017.17
7.2.30.0060.01017.24
7.2.20.0060.01016.99
7.2.10.0060.00816.97
7.2.00.0030.01317.11
7.1.250.0060.00815.93
7.1.240.0080.00816.01
7.1.230.0060.00616.07
7.1.220.0080.00315.82
7.1.210.0030.01015.80
7.1.200.0040.00716.19
7.1.190.0060.00916.06
7.1.180.0070.00716.11
7.1.170.0040.00815.77
7.1.160.0040.00816.13
7.1.150.0060.00916.00
7.1.140.0070.00415.81
7.1.130.0070.00715.82
7.1.120.0070.00715.72
7.1.110.0030.00616.00
7.1.100.0030.00616.15
7.1.90.0050.00516.21
7.1.80.0100.00716.14
7.1.70.0080.00516.56
7.1.60.0080.01017.58
7.1.50.0040.01316.65
7.1.40.0000.01616.05
7.1.30.0030.00916.10
7.1.20.0040.01116.12
7.1.10.0070.00716.11
7.1.00.0030.02319.26
7.0.330.0040.00815.57
7.0.320.0040.01215.59
7.0.310.0070.00315.67
7.0.300.0100.00315.62
7.0.290.0070.00715.39
7.0.280.0040.00815.73
7.0.270.0080.00415.54
7.0.260.0070.01015.54
7.0.250.0030.01315.42
7.0.240.0070.00715.42
7.0.230.0080.00415.74
7.0.220.0090.00615.75
7.0.210.0110.00415.66
7.0.200.0030.00816.22
7.0.190.0000.01315.50
7.0.180.0130.00315.71
7.0.170.0040.00815.64
7.0.160.0030.01015.55
7.0.150.0120.00315.45
7.0.140.0060.04018.94
7.0.130.0110.00615.62
7.0.120.0110.00015.78
7.0.110.0070.00715.37
7.0.100.0150.00315.70
7.0.90.0000.01315.35
7.0.80.0340.04517.79
7.0.70.0190.03817.81
7.0.60.0370.03917.72
7.0.50.0180.04117.88
7.0.40.0050.02816.93
7.0.30.0110.04016.85
7.0.20.0090.04116.90
7.0.10.0050.04816.92
7.0.00.0030.05116.87
5.6.380.0040.01114.73
5.6.370.0080.00414.66
5.6.360.0000.01214.61
5.6.350.0070.00414.84
5.6.340.0070.01014.71
5.6.330.0080.00814.42
5.6.320.0070.00714.69
5.6.310.0050.00814.84
5.6.300.0070.00314.63
5.6.290.0070.01014.79
5.6.280.0030.04317.98
5.6.270.0030.01314.41
5.6.260.0000.01514.71
5.6.250.0060.01314.96
5.6.240.0110.00814.44
5.6.230.0100.04017.65
5.6.220.0100.04717.56
5.6.210.0110.02517.71
5.6.200.0020.04917.93
5.6.190.0070.02818.02
5.6.180.0110.03117.66
5.6.170.0080.03517.73
5.6.160.0030.05017.88
5.6.150.0030.05217.88
5.6.140.0080.04617.72
5.6.130.0050.03417.87
5.6.120.0100.03717.93
5.6.110.0090.03117.81
5.6.100.0050.03717.83
5.6.90.0050.04917.89
5.6.80.0100.04217.48
5.6.70.0080.03317.40
5.6.60.0050.04417.51
5.6.50.0080.04117.45
5.6.40.0130.03817.51
5.6.30.0040.04517.37
5.6.20.0080.03217.35
5.6.10.0100.04217.33
5.6.00.0080.02717.39
5.5.380.0040.00813.11
5.5.370.0050.04516.85
5.5.360.0100.04016.73
5.5.350.0070.04416.73
5.5.340.0080.04016.99
5.5.330.0020.02917.02
5.5.320.0120.03617.01
5.5.310.0070.04416.95
5.5.300.0150.02817.02
5.5.290.0050.04616.88
5.5.280.0030.04817.00
5.5.270.0110.04116.88
5.5.260.0050.02317.01
5.5.250.0100.04516.92
5.5.240.0070.02316.70
5.5.230.0100.04016.69
5.5.220.0050.04016.71
5.5.210.0080.03816.68
5.5.200.0110.03816.68
5.5.190.0060.04016.69
5.5.180.0080.04116.60
5.5.170.0030.00613.11
5.5.160.0140.02316.66
5.5.150.0090.02516.63
5.5.140.0030.04616.62
5.5.130.0050.02216.56
5.5.120.0100.03916.56
5.5.110.0080.03516.67
5.5.100.0050.04216.62
5.5.90.0100.02116.55
5.5.80.0080.03216.64
5.5.70.0070.03816.56
5.5.60.0040.02416.59
5.5.50.0070.04316.59
5.5.40.0030.04316.64
5.5.30.0020.03316.62
5.5.20.0090.04316.64
5.5.10.0040.04316.61
5.5.00.0110.02316.58
5.4.450.0060.03916.28
5.4.440.0060.03916.15
5.4.430.0040.04416.29
5.4.420.0100.04116.29
5.4.410.0070.03216.21
5.4.400.0050.04516.14
5.4.390.0040.04415.99
5.4.380.0090.03316.11
5.4.370.0040.03316.13
5.4.360.0100.04016.00
5.4.350.0030.04415.97
5.4.340.0030.04316.03
5.4.330.0060.00613.11
5.4.320.0120.03716.14
5.4.310.0080.02315.99
5.4.300.0050.03916.03
5.4.290.0080.03016.12
5.4.280.0080.03716.07
5.4.270.0150.03316.11
5.4.260.0060.02816.08
5.4.250.0070.02716.03
5.4.240.0060.04116.07
5.4.230.0020.04516.11
5.4.220.0100.03516.00
5.4.210.0070.03916.17
5.4.200.0060.02315.97
5.4.190.0050.03016.13
5.4.180.0070.04016.07
5.4.170.0030.03116.06
5.4.160.0100.03416.00
5.4.150.0080.03916.07
5.4.140.0050.02814.75
5.4.130.0060.03414.67
5.4.120.0030.02614.80
5.4.110.0120.03314.82
5.4.100.0140.03314.80
5.4.90.0100.03614.81
5.4.80.0090.03814.72
5.4.70.0040.04314.82
5.4.60.0050.03614.71
5.4.50.0070.04014.72
5.4.40.0080.02314.70
5.4.30.0030.03614.86
5.4.20.0060.04014.76
5.4.10.0050.03814.77
5.4.00.0030.03614.48
5.3.290.0050.03213.92
5.3.280.0060.04013.85
5.3.270.0040.02613.90
5.3.260.0080.04213.85
5.3.250.0070.04013.86
5.3.240.0050.04013.86
5.3.230.0050.03813.84
5.3.220.0060.04113.91
5.3.210.0020.04813.87
5.3.200.0080.04113.81
5.3.190.0000.04513.82
5.3.180.0020.03013.88
5.3.170.0090.03913.81
5.3.160.0060.03313.82
5.3.150.0030.04013.90
5.3.140.0060.03013.88
5.3.130.0050.03713.87
5.3.120.0070.02313.82
5.3.110.0120.02013.83
5.3.100.0060.04013.63
5.3.90.0080.03913.60
5.3.80.0060.04013.64
5.3.70.0070.02513.52
5.3.60.0100.03713.63
5.3.50.0080.04313.53
5.3.40.0120.02313.59
5.3.30.0090.03513.57
5.3.20.0090.03913.46
5.3.10.0080.03113.39
5.3.00.0090.03913.43
5.2.170.0050.03212.20
5.2.160.0050.03412.19
5.2.150.0050.03312.16
5.2.140.0030.03512.14
5.2.130.0020.03912.05
5.2.120.0030.02012.08
5.2.110.0010.03612.06
5.2.100.0040.03612.18
5.2.90.0030.03312.11
5.2.80.0030.02112.06
5.2.70.0100.03012.04
5.2.60.0050.03512.10
5.2.50.0000.03912.10
5.2.40.0060.03212.06
5.2.30.0100.03812.02
5.2.20.0020.02312.09
5.2.10.0090.02812.00
5.2.00.0050.03111.97
5.1.60.0050.02811.97
5.1.50.0050.03011.97
5.1.40.0030.02611.97
5.1.30.0050.03011.97
5.1.20.0070.02711.97
5.1.10.0030.03311.97
5.1.00.0070.02711.97
5.0.50.0060.01211.97
5.0.40.0050.01711.97
5.0.30.0020.03611.97
5.0.20.0040.02411.97
5.0.10.0030.01911.97
5.0.00.0040.03511.97
4.4.90.0050.01611.97
4.4.80.0020.02011.97
4.4.70.0020.02011.97
4.4.60.0030.01911.97
4.4.50.0120.01011.97
4.4.40.0020.03011.97
4.4.30.0050.01111.97
4.4.20.0070.01811.97
4.4.10.0000.01811.97
4.4.00.0030.02811.97
4.3.110.0020.01911.97
4.3.100.0050.01511.97
4.3.90.0040.01711.97
4.3.80.0020.02511.97
4.3.70.0030.01811.97
4.3.60.0040.01911.97
4.3.50.0020.01711.97
4.3.40.0040.02711.97
4.3.30.0040.01911.97
4.3.20.0010.01811.97
4.3.10.0030.02111.97
4.3.00.0000.02211.97

preferences:
58.03 ms | 401 KiB | 5 Q