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); $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]) { $temp -= $i[5][$tempMonth]; } else { $days = $temp; break; } $tempMonth = $tempMonth < 10 ? $tempMonth + 1 : 0; var_dump($tempMonth); } $month = floor($inbetween / $i[0] / $i[0] / $i[1] / $i[3] % $i[4]); //$days = floor($inbetween / $i[0] / $i[0] / $i[1] % $i[3]); $hours = floor($inbetween / $i[0] / $i[0] % $i[1]); $minutes = floor($inbetween / $i[0] % $i[0]); $seconds = $inbetween % $i[0]; return $month . " 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.40.0110.00418.88
8.3.30.0100.00320.26
8.3.20.0050.00320.38
8.3.10.0050.00322.09
8.3.00.0050.00322.59
8.2.170.0120.00622.96
8.2.160.0110.00322.20
8.2.150.0030.00624.18
8.2.140.0060.00324.66
8.2.130.0080.00026.16
8.2.120.0040.00421.13
8.2.110.0040.00722.41
8.2.100.0050.00518.28
8.2.90.0040.00419.33
8.2.80.0040.00419.46
8.2.70.0030.00518.13
8.2.60.0080.00018.30
8.2.50.0080.00018.07
8.2.40.0000.00718.59
8.2.30.0040.00419.61
8.2.20.0040.00418.02
8.2.10.0040.00418.06
8.2.00.0000.00718.23
8.1.270.0080.00023.99
8.1.260.0080.00026.35
8.1.250.0050.00328.09
8.1.240.0110.01118.95
8.1.230.0080.00421.12
8.1.220.0000.00818.01
8.1.210.0050.00318.77
8.1.200.0030.00617.60
8.1.190.0040.00417.78
8.1.180.0050.00318.10
8.1.170.0060.00318.91
8.1.160.0040.00419.11
8.1.150.0000.00818.99
8.1.140.0000.00917.71
8.1.130.0000.00718.09
8.1.120.0030.00517.68
8.1.110.0040.00417.75
8.1.100.0000.00817.82
8.1.90.0050.00217.85
8.1.80.0070.00017.74
8.1.70.0000.00717.67
8.1.60.0000.00817.89
8.1.50.0040.00417.81
8.1.40.0000.00817.83
8.1.30.0000.00817.92
8.1.20.0060.00317.95
8.1.10.0000.00717.75
8.1.00.0000.00817.75
8.0.300.0070.00018.77
8.0.290.0000.00817.54
8.0.280.0000.00718.68
8.0.270.0070.00017.51
8.0.260.0040.00417.11
8.0.250.0000.00717.29
8.0.240.0060.00317.29
8.0.230.0050.00217.39
8.0.220.0050.00317.32
8.0.210.0040.00417.29
8.0.200.0070.00017.23
8.0.190.0050.00317.30
8.0.180.0000.00717.18
8.0.170.0050.00317.32
8.0.160.0040.00417.39
8.0.150.0040.00417.23
8.0.140.0050.00217.30
8.0.130.0060.00013.66
8.0.120.0080.00017.29
8.0.110.0050.00217.30
8.0.100.0000.00717.25
8.0.90.0070.00017.18
8.0.80.0090.00617.31
8.0.70.0040.00417.21
8.0.60.0000.00717.16
8.0.50.0080.00017.36
8.0.30.0130.00617.51
8.0.20.0100.01117.58
8.0.10.0040.00417.37
8.0.00.0110.01217.14
7.4.330.0030.00316.96
7.4.320.0060.00016.78
7.4.300.0000.00716.72
7.4.290.0040.00416.80
7.4.280.0000.00816.87
7.4.270.0040.00416.77
7.4.260.0030.00313.45
7.4.250.0040.00416.86
7.4.240.0040.00316.75
7.4.230.0000.00716.95
7.4.220.0100.01016.75
7.4.210.0090.00716.96
7.4.200.0030.00316.64
7.4.190.0000.00716.70
7.4.160.0110.00616.67
7.4.150.0030.01517.40
7.4.140.0090.01217.86
7.4.130.0030.01616.96
7.4.120.0060.01416.81
7.4.110.0120.00916.88
7.4.100.0070.01016.70
7.4.90.0070.01016.70
7.4.80.0090.01119.39
7.4.70.0100.00716.97
7.4.60.0030.01316.85
7.4.50.0060.00316.54
7.4.40.0060.00622.77
7.4.30.0060.00916.56
7.4.10.0000.01715.14
7.4.00.0040.01015.15
7.3.330.0000.00513.68
7.3.320.0060.00013.61
7.3.310.0050.00216.64
7.3.300.0070.00016.53
7.3.290.0070.00716.64
7.3.280.0110.00716.63
7.3.270.0140.00417.40
7.3.260.0080.01118.24
7.3.250.0190.00716.84
7.3.240.0080.00816.79
7.3.230.0130.00316.90
7.3.210.0090.00916.96
7.3.200.0030.01519.39
7.3.190.0120.00616.83
7.3.180.0090.00616.80
7.3.170.0090.00616.71
7.3.160.0070.01016.99
7.3.130.0110.00715.05
7.3.120.0090.00915.29
7.3.110.0110.00715.03
7.3.100.0100.00515.12
7.3.90.0080.00515.09
7.3.80.0020.01515.35
7.3.70.0060.00314.93
7.3.60.0090.00615.11
7.3.50.0050.00915.01
7.3.40.0030.01014.92
7.3.30.0070.00915.03
7.3.20.0030.01116.92
7.3.10.0070.00616.82
7.3.00.0020.01116.75
7.2.330.0130.00717.13
7.2.320.0130.01016.96
7.2.310.0160.00616.77
7.2.300.0040.01417.18
7.2.290.0090.00917.20
7.2.260.0150.00415.28
7.2.250.0100.00815.26
7.2.240.0110.00615.33
7.2.230.0050.01015.55
7.2.220.0090.00415.34
7.2.210.0030.01415.40
7.2.200.0070.00715.03
7.2.190.0060.00915.19
7.2.180.0090.00515.34
7.2.170.0060.00915.18
7.2.160.0110.00015.30
7.2.150.0110.00617.23
7.2.140.0110.00417.24
7.2.130.0080.00817.03
7.2.120.0070.00716.89
7.2.110.0030.01317.16
7.2.100.0070.00717.17
7.2.90.0120.00316.99
7.2.80.0000.01617.27
7.2.70.0060.00317.29
7.2.60.0040.01017.28
7.2.50.0030.01417.05
7.2.40.0070.00717.13
7.2.30.0070.00317.35
7.2.20.0000.01616.96
7.2.10.0110.00317.03
7.2.00.0040.00917.26
7.1.330.0070.00716.09
7.1.320.0080.00716.01
7.1.310.0080.00615.99
7.1.300.0050.01116.08
7.1.290.0020.01115.86
7.1.280.0110.00516.08
7.1.270.0010.01416.13
7.1.260.0030.00815.90
7.1.250.0000.01316.04
7.1.240.0090.00316.00
7.1.230.0030.01016.02
7.1.220.0080.00516.19
7.1.210.0000.00915.96
7.1.200.0020.00916.20
7.1.190.0130.00015.83
7.1.180.0030.00616.18
7.1.170.0080.00316.14
7.1.160.0090.00016.03
7.1.150.0070.00716.21
7.1.140.0140.00015.81
7.1.130.0030.01316.17
7.1.120.0000.01115.98
7.1.110.0030.01016.22
7.1.100.0030.01015.87
7.1.90.0000.01615.76
7.1.80.0040.00816.06
7.1.70.0040.00716.79
7.1.60.0060.01317.56
7.1.50.0050.01416.43
7.1.40.0140.00316.20
7.1.30.0110.00615.98
7.1.20.0060.00616.05
7.1.10.0030.01415.86
7.1.00.0030.02519.29
7.0.330.0030.01415.50
7.0.320.0080.00815.37
7.0.310.0080.00315.62
7.0.300.0030.00715.50
7.0.290.0040.00815.59
7.0.280.0000.01515.67
7.0.270.0060.00615.78
7.0.260.0100.00315.39
7.0.250.0070.00715.54
7.0.240.0030.01215.56
7.0.230.0030.01015.35
7.0.220.0070.00715.24
7.0.210.0100.00315.33
7.0.200.0090.00216.21
7.0.190.0090.00615.66
7.0.180.0090.00615.65
7.0.170.0120.00315.56
7.0.160.0060.00615.48
7.0.150.0040.01115.59
7.0.140.0050.04018.93
7.0.130.0070.01015.75
7.0.120.0060.00615.55
7.0.110.0030.00915.51
7.0.100.0120.03717.81
7.0.90.0080.03717.73
7.0.80.0040.04617.64
7.0.70.0080.03817.78
7.0.60.0090.04217.76
7.0.50.0050.04918.01
7.0.40.0090.04216.96
7.0.30.0100.04316.93
7.0.20.0050.03516.94
7.0.10.0050.02416.96
7.0.00.0050.02516.78
5.6.400.0090.00314.51
5.6.390.0070.01014.65
5.6.380.0150.00314.73
5.6.370.0000.01114.65
5.6.360.0090.00614.33
5.6.350.0000.00914.76
5.6.340.0000.01814.77
5.6.330.0060.00614.19
5.6.320.0090.00014.24
5.6.310.0090.00014.91
5.6.300.0100.00714.72
5.6.290.0030.00914.67
5.6.280.0020.04017.75
5.6.270.0070.00714.67
5.6.260.0040.01114.71
5.6.250.0070.04617.57
5.6.240.0070.03417.56
5.6.230.0110.02517.79
5.6.220.0080.03417.54
5.6.210.0120.04117.57
5.6.200.0030.05017.78
5.6.190.0100.03317.73
5.6.180.0050.05017.70
5.6.170.0060.04717.95
5.6.160.0080.02517.70
5.6.150.0050.04817.84
5.6.140.0020.03517.78
5.6.130.0110.04317.87
5.6.120.0050.02417.79
5.6.110.0090.04317.81
5.6.100.0050.03617.73
5.6.90.0030.04617.65
5.6.80.0070.04217.47
5.6.70.0030.04517.46
5.6.60.0030.03717.51
5.6.50.0050.03317.52
5.6.40.0080.04017.64
5.6.30.0090.03317.40
5.6.20.0050.02917.30
5.6.10.0050.02717.62
5.6.00.0090.03717.56
5.5.380.0080.04617.66
5.5.370.0070.03617.54
5.5.360.0070.04417.55
5.5.350.0050.04917.56
5.5.340.0110.02117.71
5.5.330.0090.04217.64
5.5.320.0050.02817.69
5.5.310.0080.04517.67
5.5.300.0030.04817.74
5.5.290.0080.03917.72
5.5.280.0080.03517.72
5.5.270.0130.03817.77
5.5.260.0060.04817.68
5.5.250.0070.02317.54
5.5.240.0070.03717.34
5.5.230.0180.03217.33
5.5.220.0010.02617.29
5.5.210.0020.04217.29
5.5.200.0090.03217.31
5.5.190.0130.04317.43
5.5.180.0030.04717.39
5.5.170.0030.01314.74
5.5.160.0030.04717.23
5.5.150.0090.03817.30
5.5.140.0050.03717.41
5.5.130.0100.03817.51
5.5.120.0050.04617.41
5.5.110.0120.02517.28
5.5.100.0080.03817.45
5.5.90.0100.03217.15
5.5.80.0000.03117.30
5.5.70.0080.04117.32
5.5.60.0070.04117.18
5.5.50.0040.02717.29
5.5.40.0030.04317.41
5.5.30.0070.03817.18
5.5.20.0110.04117.49
5.5.10.0050.04017.32
5.5.00.0080.04017.12
5.4.450.0050.02515.70
5.4.440.0050.02715.70
5.4.430.0070.04015.69
5.4.420.0070.04015.60
5.4.410.0030.02915.45
5.4.400.0100.03815.52
5.4.390.0080.04015.43
5.4.380.0030.02515.44
5.4.370.0050.03515.50
5.4.360.0070.04015.46
5.4.350.0080.04015.38
5.4.340.0070.03715.48
5.4.330.0000.01111.83
5.4.320.0050.02515.44
5.4.310.0070.03715.47
5.4.300.0100.03315.46
5.4.290.0080.04015.46
5.4.280.0070.02815.52
5.4.270.0070.04315.49
5.4.260.0030.03515.49
5.4.250.0070.03915.47
5.4.240.0090.03915.49
5.4.230.0040.04015.50
5.4.220.0030.03115.36
5.4.210.0080.03815.47
5.4.200.0050.03615.35
5.4.190.0080.03715.49
5.4.180.0050.02715.42
5.4.170.0050.03915.43
5.4.160.0100.03815.36
5.4.150.0100.03915.42
5.4.140.0060.02914.12
5.4.130.0080.02014.16
5.4.120.0070.02714.22
5.4.110.0050.04014.11
5.4.100.0030.04214.20
5.4.90.0070.02314.16
5.4.80.0050.03414.13
5.4.70.0070.03714.15
5.4.60.0040.02714.15
5.4.50.0060.03614.13
5.4.40.0110.02814.16
5.4.30.0050.03314.14
5.4.20.0050.02714.08
5.4.10.0050.03814.15
5.4.00.0020.04113.87
5.3.290.0100.03713.37
5.3.280.0050.02713.37
5.3.270.0050.04013.37
5.3.260.0060.04513.37
5.3.250.0050.02613.37
5.3.240.0030.02713.37
5.3.230.0030.04213.37
5.3.220.0050.03913.37
5.3.210.0090.03913.37
5.3.200.0050.03213.37
5.3.190.0010.02813.37
5.3.180.0050.03713.37
5.3.170.0030.03913.37
5.3.160.0060.03513.37
5.3.150.0070.03713.37
5.3.140.0060.04013.37
5.3.130.0030.04013.37
5.3.120.0120.03413.37
5.3.110.0050.04213.37
5.3.100.0050.04013.37
5.3.90.0050.04013.37
5.3.80.0030.03813.37
5.3.70.0100.03913.37
5.3.60.0030.02413.37
5.3.50.0050.03213.37
5.3.40.0020.04113.37
5.3.30.0040.03913.37
5.3.20.0050.04013.37
5.3.10.0060.03313.37
5.3.00.0050.04213.37
5.2.170.0030.04714.92
5.2.160.0030.04314.92
5.2.150.0030.06314.92
5.2.140.0170.03314.92
5.2.130.0130.05714.92
5.2.120.0100.06014.92
5.2.110.0100.05714.92
5.2.100.0100.05714.92
5.2.90.0030.06714.92
5.2.80.0030.05314.92
5.2.70.0000.07014.92
5.2.60.0000.07014.92
5.2.50.0030.06714.92
5.2.40.0030.06014.92
5.2.30.0030.05714.92
5.2.20.0030.06314.92
5.2.10.0130.04314.92
5.2.00.0030.06314.92
5.1.60.0000.03014.92
5.1.50.0030.05714.92
5.1.40.0000.04314.92
5.1.30.0030.04714.92
5.1.20.0070.03014.92
5.1.10.0030.04314.92
5.1.00.0070.05314.92
5.0.50.0030.04314.92
5.0.40.0000.02314.92
5.0.30.0030.06714.92
5.0.20.0070.04014.92
5.0.10.0000.04714.92
5.0.00.0030.03314.92
4.4.90.0030.03714.92
4.4.80.0000.03714.92
4.4.70.0000.03714.92
4.4.60.0000.03714.92
4.4.50.0000.02314.92
4.4.40.0030.03014.92
4.4.30.0030.03714.92
4.4.20.0070.03314.92
4.4.10.0000.04014.92
4.4.00.0030.03314.92
4.3.110.0070.03314.92
4.3.100.0030.01714.92
4.3.90.0000.03314.92
4.3.80.0000.03014.92
4.3.70.0030.03714.92
4.3.60.0000.02314.92
4.3.50.0030.01714.92
4.3.40.0030.02314.92
4.3.30.0000.01714.92
4.3.20.0030.03314.92
4.3.10.0000.03714.92
4.3.00.0000.01714.92

preferences:
53.08 ms | 400 KiB | 5 Q