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]) / 365; $tempMonth = date('n', strtotime('-1 year', $second)) - 1; for($n = 0; $n < 12; $n++) { 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.00418.78
8.3.50.0130.00821.33
8.3.40.0120.00319.09
8.3.30.0100.00320.29
8.3.20.0080.00020.29
8.3.10.0090.00021.97
8.3.00.0040.00422.58
8.2.180.0120.00917.13
8.2.170.0110.00422.96
8.2.160.0100.00322.33
8.2.150.0000.00824.18
8.2.140.0000.01024.66
8.2.130.0050.00326.16
8.2.120.0000.00821.12
8.2.110.0030.00620.65
8.2.100.0080.00421.27
8.2.90.0080.00019.43
8.2.80.0040.00419.34
8.2.70.0050.00318.00
8.2.60.0030.00518.18
8.2.50.0000.00818.07
8.2.40.0040.00418.57
8.2.30.0040.00419.47
8.2.20.0030.00518.18
8.2.10.0030.00618.04
8.2.00.0090.00018.23
8.1.280.0100.00725.92
8.1.270.0030.00623.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0070.00324.10
8.1.230.0120.00022.93
8.1.220.0030.00517.74
8.1.210.0060.00318.77
8.1.200.0040.00717.60
8.1.190.0040.00417.65
8.1.180.0030.00518.10
8.1.170.0090.00018.71
8.1.160.0000.00819.16
8.1.150.0070.00018.99
8.1.140.0080.00017.68
8.1.130.0050.00318.05
8.1.120.0000.00717.82
8.1.110.0000.00717.82
8.1.100.0040.00417.79
8.1.90.0000.00717.69
8.1.80.0000.00717.83
8.1.70.0000.00817.77
8.1.60.0060.00317.94
8.1.50.0040.00417.84
8.1.40.0040.00417.80
8.1.30.0000.00917.85
8.1.20.0030.00617.94
8.1.10.0000.00717.83
8.1.00.0000.00817.75
8.0.300.0070.00018.77
8.0.290.0040.00417.55
8.0.280.0070.00018.66
8.0.270.0030.00517.44
8.0.260.0000.00717.29
8.0.250.0000.00717.40
8.0.240.0040.00417.35
8.0.230.0070.00017.26
8.0.220.0030.00317.18
8.0.210.0030.00317.30
8.0.200.0000.00717.34
8.0.190.0070.00017.28
8.0.180.0030.00517.23
8.0.170.0040.00417.21
8.0.160.0050.00317.30
8.0.150.0000.00717.14
8.0.140.0000.00717.18
8.0.130.0030.00313.68
8.0.120.0000.00817.29
8.0.110.0070.00017.27
8.0.100.0040.00417.31
8.0.90.0050.00217.30
8.0.80.0110.00717.36
8.0.70.0040.00417.27
8.0.60.0020.00517.32
8.0.50.0040.00417.29
8.0.30.0080.01117.41
8.0.20.0120.00517.54
8.0.10.0040.00417.38
8.0.00.0150.00817.19
7.4.330.0000.00516.96
7.4.320.0000.00616.85
7.4.300.0000.00716.92
7.4.290.0040.00416.81
7.4.280.0080.00016.83
7.4.270.0040.00416.82
7.4.260.0000.00613.52
7.4.250.0050.00316.78
7.4.240.0020.00516.89
7.4.230.0000.00716.71
7.4.220.0160.00316.95
7.4.210.0090.00816.85
7.4.200.0070.00016.84
7.4.190.0030.00316.86
7.4.160.0170.00716.92
7.4.150.0110.00717.40
7.4.140.0090.01017.86
7.4.130.0060.01116.80
7.4.120.0050.01216.98
7.4.110.0040.01416.82
7.4.100.0150.00316.88
7.4.90.0120.00616.71
7.4.80.0060.01219.39
7.4.70.0090.00816.64
7.4.60.0090.00916.81
7.4.50.0000.00816.68
7.4.40.0080.01122.77
7.4.30.0060.01216.98
7.4.10.0090.00915.50
7.4.00.0070.01215.49
7.3.330.0050.00013.61
7.3.320.0000.00613.52
7.3.310.0040.00416.47
7.3.300.0070.00016.66
7.3.290.0100.01016.67
7.3.280.0060.01016.63
7.3.270.0090.00917.40
7.3.260.0060.01318.24
7.3.250.0110.00816.86
7.3.240.0060.01016.96
7.3.230.0000.01616.89
7.3.210.0160.00616.86
7.3.200.0030.01319.39
7.3.190.0110.00816.67
7.3.180.0100.00616.86
7.3.170.0070.01016.91
7.3.160.0060.00916.82
7.3.130.0110.00814.93
7.3.120.0110.00515.17
7.3.110.0090.00614.98
7.3.100.0100.00315.06
7.3.90.0100.00315.29
7.3.80.0060.01315.08
7.3.70.0060.00315.16
7.3.60.0030.01314.87
7.3.50.0060.01015.18
7.3.40.0070.00714.74
7.3.30.0040.01215.10
7.3.20.0130.00016.85
7.3.10.0110.01016.68
7.3.00.0130.00416.82
7.2.330.0150.00316.93
7.2.320.0090.01416.73
7.2.310.0070.01117.20
7.2.300.0090.00916.96
7.2.290.0110.00516.95
7.2.260.0030.01615.53
7.2.250.0120.00015.20
7.2.240.0100.00315.51
7.2.230.0090.00615.56
7.2.220.0060.01315.23
7.2.210.0060.00915.20
7.2.200.0040.00715.47
7.2.190.0090.00915.07
7.2.180.0070.01015.33
7.2.170.0140.00015.43
7.2.160.0030.01015.23
7.2.150.0030.00716.88
7.2.140.0100.00717.23
7.2.130.0150.00416.86
7.2.120.0100.01017.14
7.2.110.0110.01017.06
7.2.100.0160.00516.95
7.2.90.0080.00617.13
7.2.80.0110.00717.19
7.2.70.0100.01116.87
7.2.60.0090.01317.00
7.2.50.0070.01416.95
7.2.40.0080.00916.99
7.2.30.0120.01016.99
7.2.20.0110.01016.80
7.2.10.0050.01116.89
7.2.00.0140.00517.86
7.1.330.0140.00016.14
7.1.320.0100.00315.95
7.1.310.0060.00616.16
7.1.300.0070.01316.14
7.1.290.0080.00816.00
7.1.280.0050.00816.03
7.1.270.0030.01316.07
7.1.260.0000.01216.02
7.1.250.0110.00615.76
7.1.240.0120.00316.20
7.1.230.0000.01115.95
7.1.220.0100.00315.88
7.1.210.0060.00615.89
7.1.200.0060.01216.10
7.1.190.0030.01016.25
7.1.180.0030.00616.20
7.1.170.0040.00816.16
7.1.160.0040.00815.80
7.1.150.0090.00616.13
7.1.140.0110.00715.82
7.1.130.0060.00616.16
7.1.120.0070.00715.65
7.1.110.0110.00715.98
7.1.100.0050.00617.25
7.1.90.0070.00715.93
7.1.80.0100.00715.97
7.1.70.0030.00516.59
7.1.60.0080.01017.69
7.1.50.0070.01416.63
7.1.40.0120.00316.12
7.1.30.0030.00816.22
7.1.20.0030.01016.04
7.1.10.0000.01415.99
7.1.00.0030.02019.13
7.0.330.0030.01315.44
7.0.320.0100.00315.67
7.0.310.0030.00915.20
7.0.300.0060.00615.72
7.0.290.0000.01315.60
7.0.280.0040.00815.58
7.0.270.0000.01215.62
7.0.260.0070.00415.59
7.0.250.0040.01115.77
7.0.240.0000.01215.60
7.0.230.0070.00715.48
7.0.220.0050.00515.43
7.0.210.0060.00315.48
7.0.200.0060.00316.34
7.0.190.0110.00415.63
7.0.180.0000.01115.59
7.0.170.0060.00615.66
7.0.160.0030.01015.52
7.0.150.0030.01015.65
7.0.140.0070.04018.70
7.0.130.0000.01215.75
7.0.120.0090.00315.63
7.0.110.0090.00315.43
7.0.100.0200.03617.76
7.0.90.0200.04417.82
7.0.80.0280.03317.66
7.0.70.0190.03717.85
7.0.60.0180.04017.77
7.0.50.0270.04218.00
7.0.40.0050.04716.91
7.0.30.0100.04316.88
7.0.20.0070.03216.81
7.0.10.0100.04316.88
7.0.00.0130.03216.68
5.6.400.0070.00714.68
5.6.390.0040.00414.60
5.6.380.0030.01214.48
5.6.370.0080.00814.63
5.6.360.0040.01114.57
5.6.350.0040.01114.72
5.6.340.0080.01114.56
5.6.330.0030.01214.32
5.6.320.0030.00714.63
5.6.310.0030.01014.78
5.6.300.0090.00614.77
5.6.290.0100.00314.65
5.6.280.0050.04018.02
5.6.270.0070.00714.87
5.6.260.0040.01114.73
5.6.250.0090.04317.54
5.6.240.0050.02917.72
5.6.230.0060.04817.56
5.6.220.0070.02317.63
5.6.210.0050.03117.81
5.6.200.0100.04617.79
5.6.190.0050.02717.83
5.6.180.0040.02317.85
5.6.170.0050.04717.72
5.6.160.0050.04817.75
5.6.150.0030.04017.94
5.6.140.0080.03717.85
5.6.130.0110.04117.65
5.6.120.0080.04517.81
5.6.110.0050.02517.91
5.6.100.0050.04417.88
5.6.90.0050.03417.95
5.6.80.0080.03317.45
5.6.70.0030.03417.66
5.6.60.0090.03117.48
5.6.50.0050.03517.47
5.6.40.0070.03417.37
5.6.30.0070.03617.37
5.6.20.0030.03317.43
5.6.10.0030.04417.45
5.6.00.0050.04017.36
5.5.380.0050.04117.59
5.5.370.0100.03617.49
5.5.360.0020.03117.50
5.5.350.0030.04517.46
5.5.340.0000.05017.74
5.5.330.0090.02417.73
5.5.320.0070.04317.83
5.5.310.0030.02817.86
5.5.300.0090.03917.82
5.5.290.0120.03817.55
5.5.280.0010.03117.78
5.5.270.0090.04217.70
5.5.260.0060.04017.78
5.5.250.0100.04517.28
5.5.240.0080.04317.43
5.5.230.0020.03217.16
5.5.220.0030.02517.30
5.5.210.0100.03517.44
5.5.200.0090.03717.29
5.5.190.0120.02717.44
5.5.180.0050.04317.39
5.5.170.0030.01014.32
5.5.160.0070.04417.45
5.5.150.0110.04017.39
5.5.140.0050.03017.25
5.5.130.0070.04017.45
5.5.120.0050.04817.31
5.5.110.0070.02517.42
5.5.100.0100.04217.20
5.5.90.0080.02117.44
5.5.80.0040.02417.36
5.5.70.0020.03317.34
5.5.60.0050.02317.34
5.5.50.0070.02517.36
5.5.40.0030.02717.39
5.5.30.0060.02317.31
5.5.20.0070.02617.11
5.5.10.0020.02817.21
5.5.00.0050.02417.37
5.4.450.0090.04115.34
5.4.440.0050.02615.60
5.4.430.0100.03715.49
5.4.420.0070.03015.46
5.4.410.0080.04015.34
5.4.400.0060.03815.13
5.4.390.0100.03615.10
5.4.380.0050.03415.21
5.4.370.0070.03915.24
5.4.360.0050.03915.22
5.4.350.0080.03815.18
5.4.340.0080.02015.19
5.4.330.0060.00011.34
5.4.320.0110.03515.03
5.4.310.0020.02715.11
5.4.300.0070.04015.14
5.4.290.0050.03815.09
5.4.280.0040.05215.17
5.4.270.0090.03415.14
5.4.260.0080.02315.21
5.4.250.0000.04315.16
5.4.240.0020.02515.34
5.4.230.0110.03515.00
5.4.220.0050.02515.26
5.4.210.0040.02215.08
5.4.200.0020.02415.32
5.4.190.0030.02315.18
5.4.180.0030.02415.16
5.4.170.0020.02815.12
5.4.160.0050.02215.08
5.4.150.0020.02515.20
5.4.140.0030.02513.70
5.4.130.0010.02813.86
5.4.120.0020.02013.95
5.4.110.0040.03813.88
5.4.100.0060.03613.93
5.4.90.0030.02413.92
5.4.80.0030.03313.97
5.4.70.0050.02613.78
5.4.60.0030.01813.83
5.4.50.0030.01913.74
5.4.40.0020.02213.89
5.4.30.0030.02013.90
5.4.20.0000.02413.92
5.4.10.0020.02213.87
5.4.00.0050.01813.51
5.3.290.0100.03812.79
5.3.280.0030.03712.93
5.3.270.0020.02412.92
5.3.260.0030.02212.93
5.3.250.0060.01712.90
5.3.240.0020.02512.89
5.3.230.0030.02912.76
5.3.220.0030.02012.83
5.3.210.0040.01912.71
5.3.200.0070.03812.87
5.3.190.0020.03112.76
5.3.180.0020.02712.95
5.3.170.0020.02412.88
5.3.160.0020.02312.95
5.3.150.0050.04012.95
5.3.140.0040.01912.92
5.3.130.0030.02612.78
5.3.120.0020.02312.89
5.3.110.0000.02512.88
5.3.100.0060.02012.88
5.3.90.0020.02012.91
5.3.80.0050.02212.85
5.3.70.0060.02212.89
5.3.60.0050.01712.87
5.3.50.0020.02012.74
5.3.40.0090.01312.89
5.3.30.0040.01712.86
5.3.20.0070.01712.86
5.3.10.0090.01512.69
5.3.00.0050.03112.74
5.2.170.0000.03014.92
5.2.160.0030.06014.92
5.2.150.0000.03314.92
5.2.140.0030.03314.92
5.2.130.0000.03314.92
5.2.120.0000.03314.92
5.2.110.0000.02714.92
5.2.100.0070.02014.92
5.2.90.0000.03014.92
5.2.80.0000.03714.92
5.2.70.0000.03014.92
5.2.60.0000.03014.92
5.2.50.0030.03014.92
5.2.40.0030.02714.92
5.2.30.0030.02714.92
5.2.20.0000.03014.92
5.2.10.0070.02314.92
5.2.00.0000.02314.92
5.1.60.0000.02714.92
5.1.50.0000.02714.92
5.1.40.0000.02714.92
5.1.30.0030.02314.92
5.1.20.0030.02314.92
5.1.10.0000.02714.92
5.1.00.0000.02714.92
5.0.50.0100.03714.92
5.0.40.0100.03714.92
5.0.30.0030.06314.92
5.0.20.0070.03714.92
5.0.10.0030.03014.92
5.0.00.0100.05714.92
4.4.90.0030.01314.92
4.4.80.0000.01714.92
4.4.70.0000.01714.92
4.4.60.0000.01714.92
4.4.50.0000.01314.92
4.4.40.0030.01714.92
4.4.30.0030.01314.92
4.4.20.0000.01714.92
4.4.10.0030.01314.92
4.4.00.0030.05014.92
4.3.110.0070.03014.92
4.3.100.0000.02714.92
4.3.90.0000.02314.92
4.3.80.0000.04714.92
4.3.70.0000.02014.92
4.3.60.0000.03714.92
4.3.50.0000.04014.92
4.3.40.0030.05314.92
4.3.30.0030.03714.92
4.3.20.0070.02014.92
4.3.10.0000.02314.92
4.3.00.0030.03314.92

preferences:
37.72 ms | 401 KiB | 5 Q