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)); for($n = 0; $n < 12; $n++) { $tempMonth = $tempMonth > 10 ? $tempMonth + 1 : 0; var_dump($tempMonth); if($temp >= $i[5][$tempMonth]) { $temp -= $i[5][$tempMonth]; } else { $days = $temp; break; } } $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.70.0170.00317.13
8.3.60.0210.00018.81
8.3.50.0100.00621.15
8.3.40.0070.00719.13
8.3.30.0120.00320.47
8.3.20.0040.00420.46
8.3.10.0090.00022.04
8.3.00.0000.00822.57
8.2.180.0180.00316.88
8.2.170.0120.00322.96
8.2.160.0100.00322.39
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0050.00326.16
8.2.120.0050.00320.91
8.2.110.0070.00319.43
8.2.100.0080.00418.09
8.2.90.0000.00919.52
8.2.80.0080.00018.29
8.2.70.0080.00017.88
8.2.60.0030.00618.28
8.2.50.0050.00318.07
8.2.40.0040.00418.59
8.2.30.0040.00419.54
8.2.20.0070.00018.20
8.2.10.0000.00818.09
8.2.00.0000.00818.16
8.1.280.0030.01325.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0030.00528.09
8.1.240.0060.00324.09
8.1.230.0070.00421.03
8.1.220.0050.00318.77
8.1.210.0000.00820.80
8.1.200.0040.00717.47
8.1.190.0000.00817.91
8.1.180.0060.00318.10
8.1.170.0040.00418.95
8.1.160.0000.00719.06
8.1.150.0040.00418.94
8.1.140.0000.00817.80
8.1.130.0070.00017.97
8.1.120.0070.00017.88
8.1.110.0000.00717.80
8.1.100.0050.00217.79
8.1.90.0040.00417.84
8.1.80.0000.00817.64
8.1.70.0030.00317.68
8.1.60.0030.00617.82
8.1.50.0030.00617.72
8.1.40.0050.00317.78
8.1.30.0040.00417.88
8.1.20.0000.00817.97
8.1.10.0040.00417.92
8.1.00.0050.00317.89
8.0.300.0050.00320.18
8.0.290.0070.00017.30
8.0.280.0040.00418.76
8.0.270.0030.00317.53
8.0.260.0030.00317.24
8.0.250.0030.00317.39
8.0.240.0040.00417.43
8.0.230.0060.00317.26
8.0.220.0000.00717.29
8.0.210.0040.00417.18
8.0.200.0030.00317.23
8.0.190.0030.00617.30
8.0.180.0040.00417.34
8.0.170.0060.00317.27
8.0.160.0030.00517.13
8.0.150.0000.00817.36
8.0.140.0000.00817.23
8.0.130.0030.00313.69
8.0.120.0040.00417.24
8.0.110.0020.00517.36
8.0.100.0000.00717.11
8.0.90.0100.00017.14
8.0.80.0080.00817.20
8.0.70.0000.00717.31
8.0.60.0050.00217.16
8.0.50.0000.00717.37
8.0.30.0050.01517.25
8.0.20.0110.00717.48
8.0.10.0080.00017.33
8.0.00.0060.01217.09
7.4.330.0050.00016.82
7.4.320.0030.00316.72
7.4.300.0060.00016.77
7.4.290.0030.00316.80
7.4.280.0070.00016.88
7.4.270.0000.00816.87
7.4.260.0030.00613.45
7.4.250.0040.00416.81
7.4.240.0020.00516.85
7.4.230.0000.00716.79
7.4.220.0090.00916.78
7.4.210.0080.00816.81
7.4.200.0030.00316.80
7.4.190.0030.00316.79
7.4.160.0190.00316.66
7.4.150.0100.01017.40
7.4.140.0130.01017.86
7.4.130.0120.00516.79
7.4.120.0120.00817.04
7.4.110.0080.00816.88
7.4.100.0120.00817.03
7.4.90.0110.00916.77
7.4.80.0130.01219.39
7.4.70.0060.01016.96
7.4.60.0080.00816.98
7.4.50.0000.00816.86
7.4.40.0040.00722.77
7.4.30.0070.01016.71
7.4.10.0070.01315.24
7.4.00.0060.01215.02
7.3.330.0050.00013.79
7.3.320.0030.00313.73
7.3.310.0070.00016.51
7.3.300.0030.00316.73
7.3.290.0040.01016.72
7.3.280.0090.00916.68
7.3.270.0100.00717.40
7.3.260.0140.00618.24
7.3.250.0110.01216.88
7.3.240.0120.00616.84
7.3.230.0100.00716.74
7.3.210.0050.01316.98
7.3.200.0150.00619.39
7.3.190.0100.01316.79
7.3.180.0100.00616.81
7.3.170.0090.01216.98
7.3.160.0100.00716.85
7.3.130.0040.01415.14
7.3.120.0050.00815.21
7.3.110.0130.00715.39
7.3.100.0060.00914.93
7.3.90.0060.00914.98
7.3.80.0030.00914.97
7.3.70.0030.00915.28
7.3.60.0060.00815.26
7.3.50.0030.01215.04
7.3.40.0100.00614.74
7.3.30.0040.00415.18
7.3.20.0050.00317.06
7.3.10.0030.01016.93
7.3.00.0140.00016.91
7.2.330.0070.01016.95
7.2.320.0090.00916.84
7.2.310.0090.00916.85
7.2.300.0100.00717.10
7.2.290.0030.01517.00
7.2.260.0030.01415.36
7.2.250.0060.01215.28
7.2.240.0000.01515.36
7.2.230.0100.00715.48
7.2.220.0030.00615.36
7.2.210.0130.00015.39
7.2.200.0090.00315.53
7.2.190.0000.01415.40
7.2.180.0030.01315.26
7.2.170.0060.01215.18
7.2.160.0070.00715.24
7.2.150.0070.00417.35
7.2.140.0100.00617.28
7.2.130.0070.00317.22
7.2.120.0030.00917.27
7.2.110.0000.00917.05
7.2.100.0070.00716.84
7.2.90.0040.01117.21
7.2.80.0030.00717.28
7.2.70.0090.00616.91
7.2.60.0030.01017.29
7.2.50.0040.00717.17
7.2.40.0130.00317.11
7.2.30.0000.01817.25
7.2.20.0090.00917.02
7.2.10.0040.01217.23
7.2.00.0030.00918.44
7.1.330.0100.00716.02
7.1.320.0030.01015.89
7.1.310.0120.00016.20
7.1.300.0090.00615.94
7.1.290.0030.00715.96
7.1.280.0000.01016.11
7.1.270.0110.00415.99
7.1.260.0030.01015.95
7.1.250.0060.00616.08
7.1.240.0000.01116.15
7.1.230.0030.00715.93
7.1.220.0090.00915.89
7.1.210.0070.01015.82
7.1.200.0040.00716.07
7.1.190.0080.00516.09
7.1.180.0060.00316.07
7.1.170.0080.00415.92
7.1.160.0120.00615.89
7.1.150.0080.00416.12
7.1.140.0000.01516.03
7.1.130.0070.00316.02
7.1.120.0120.00016.18
7.1.110.0090.00316.15
7.1.100.0080.00617.06
7.1.90.0000.01216.21
7.1.80.0150.00016.20
7.1.70.0100.00616.57
7.1.60.0070.01117.70
7.1.50.0050.01316.53
7.1.40.0070.00715.95
7.1.30.0130.00015.86
7.1.20.0030.01016.07
7.1.10.0000.01415.82
7.1.00.0050.02019.33
7.0.330.0000.01415.55
7.0.320.0000.01815.51
7.0.310.0130.00015.72
7.0.300.0040.00815.62
7.0.290.0040.01115.75
7.0.280.0040.00715.62
7.0.270.0070.01015.34
7.0.260.0140.00015.43
7.0.250.0030.00615.60
7.0.240.0090.00315.74
7.0.230.0030.01015.59
7.0.220.0070.00315.37
7.0.210.0000.01515.68
7.0.200.0030.00816.22
7.0.190.0030.01015.56
7.0.180.0030.01015.67
7.0.170.0040.00715.60
7.0.160.0090.00315.68
7.0.150.0070.00315.71
7.0.140.0030.04118.84
7.0.130.0090.00615.66
7.0.120.0060.00915.76
7.0.110.0070.01015.67
7.0.100.0090.03917.85
7.0.90.0140.03817.77
7.0.80.0070.04517.60
7.0.70.0250.04017.69
7.0.60.0060.04317.73
7.0.50.0220.02817.93
7.0.40.0090.04116.91
7.0.30.0050.03016.91
7.0.20.0070.03116.92
7.0.10.0050.02816.75
7.0.00.0080.04516.80
5.6.400.0070.00314.64
5.6.390.0000.01414.60
5.6.380.0100.01014.64
5.6.370.0100.00714.35
5.6.360.0060.01014.76
5.6.350.0030.01414.54
5.6.340.0060.00614.93
5.6.330.0060.00314.90
5.6.320.0060.00314.36
5.6.310.0030.00614.18
5.6.300.0080.00414.59
5.6.290.0070.00714.46
5.6.280.0040.03917.74
5.6.270.0040.01114.65
5.6.260.0000.01514.68
5.6.250.0070.02917.77
5.6.240.0070.04017.73
5.6.230.0090.02517.61
5.6.220.0070.04517.56
5.6.210.0060.02817.59
5.6.200.0100.04317.92
5.6.190.0050.02717.92
5.6.180.0120.03417.93
5.6.170.0080.02517.80
5.6.160.0110.04117.75
5.6.150.0160.03317.84
5.6.140.0140.03817.77
5.6.130.0100.03817.78
5.6.120.0100.04317.72
5.6.110.0080.04618.00
5.6.100.0080.03317.75
5.6.90.0080.04317.89
5.6.80.0060.02317.54
5.6.70.0100.03817.59
5.6.60.0060.04017.49
5.6.50.0030.04317.37
5.6.40.0050.04017.52
5.6.30.0080.03417.47
5.6.20.0070.04017.41
5.6.10.0030.04117.51
5.6.00.0050.02917.49
5.5.380.0080.02817.61
5.5.370.0090.02217.61
5.5.360.0100.04117.41
5.5.350.0020.04817.41
5.5.340.0080.03017.56
5.5.330.0070.03117.64
5.5.320.0080.03817.69
5.5.310.0080.03317.59
5.5.300.0080.04217.80
5.5.290.0090.03917.88
5.5.280.0050.03617.56
5.5.270.0050.04717.83
5.5.260.0120.04017.78
5.5.250.0030.03517.60
5.5.240.0050.02917.30
5.5.230.0110.02117.48
5.5.220.0100.03317.33
5.5.210.0070.04017.30
5.5.200.0030.04717.31
5.5.190.0030.02417.36
5.5.180.0090.04117.35
5.5.170.0090.00314.25
5.5.160.0080.02217.34
5.5.150.0080.03117.23
5.5.140.0050.02617.43
5.5.130.0110.03617.38
5.5.120.0100.03817.42
5.5.110.0050.04017.35
5.5.100.0070.03217.43
5.5.90.0050.03417.43
5.5.80.0070.04017.38
5.5.70.0050.04317.39
5.5.60.0140.03117.49
5.5.50.0040.04517.38
5.5.40.0050.04317.05
5.5.30.0070.04417.46
5.5.20.0120.03817.29
5.5.10.0060.03617.30
5.5.00.0070.04417.33
5.4.450.0020.04616.06
5.4.440.0070.02415.97
5.4.430.0070.03416.04
5.4.420.0090.03015.96
5.4.410.0050.03415.95
5.4.400.0020.03415.85
5.4.390.0070.02415.85
5.4.380.0070.01615.90
5.4.370.0060.04115.85
5.4.360.0000.04315.87
5.4.350.0060.02515.85
5.4.340.0120.04515.85
5.4.330.0040.00712.57
5.4.320.0030.02215.83
5.4.310.0040.02315.84
5.4.300.0070.02015.90
5.4.290.0080.04215.76
5.4.280.0050.02215.86
5.4.270.0100.03515.87
5.4.260.0110.02915.87
5.4.250.0050.02515.84
5.4.240.0090.03615.89
5.4.230.0080.03915.73
5.4.220.0050.03515.80
5.4.210.0070.04215.86
5.4.200.0040.03415.80
5.4.190.0060.04615.75
5.4.180.0090.03915.83
5.4.170.0110.04015.83
5.4.160.0050.02715.73
5.4.150.0080.03515.80
5.4.140.0090.03514.49
5.4.130.0070.03014.51
5.4.120.0020.03914.38
5.4.110.0030.02514.53
5.4.100.0040.02314.48
5.4.90.0090.02114.53
5.4.80.0120.03314.52
5.4.70.0040.02914.44
5.4.60.0040.02514.45
5.4.50.0050.02214.51
5.4.40.0080.03714.51
5.4.30.0020.02614.48
5.4.20.0020.03214.50
5.4.10.0050.03514.49
5.4.00.0020.02514.19
5.3.290.0030.02413.63
5.3.280.0080.02313.64
5.3.270.0050.03213.64
5.3.260.0070.03513.58
5.3.250.0080.03813.58
5.3.240.0040.02913.59
5.3.230.0050.02113.66
5.3.220.0030.02813.57
5.3.210.0050.03813.57
5.3.200.0020.03213.55
5.3.190.0070.02313.60
5.3.180.0060.03413.56
5.3.170.0100.01613.59
5.3.160.0090.03513.55
5.3.150.0040.02313.57
5.3.140.0090.03513.58
5.3.130.0060.03813.61
5.3.120.0070.03513.53
5.3.110.0030.02313.57
5.3.100.0020.02613.31
5.3.90.0050.03013.36
5.3.80.0030.02513.30
5.3.70.0010.02313.35
5.3.60.0100.01813.33
5.3.50.0080.02613.34
5.3.40.0060.02813.29
5.3.30.0080.03713.26
5.3.20.0060.04513.14
5.3.10.0050.03313.09
5.3.00.0030.03913.09
5.2.170.0130.03311.81
5.2.160.0000.05011.81
5.2.150.0070.06011.81
5.2.140.0070.02711.81
5.2.130.0000.03011.81
5.2.120.0000.05711.81
5.2.110.0070.05711.81
5.2.100.0070.05711.81
5.2.90.0030.06311.81
5.2.80.0030.06311.81
5.2.70.0030.03311.81
5.2.60.0030.06011.81
5.2.50.0030.04011.81
5.2.40.0030.06311.81
5.2.30.0100.05311.81
5.2.20.0030.03311.81
5.2.10.0030.06311.81
5.2.00.0100.05011.81
5.1.60.0000.02711.81
5.1.50.0030.05311.81
5.1.40.0030.04311.81
5.1.30.0000.05011.81
5.1.20.0000.03311.81
5.1.10.0100.03011.81
5.1.00.0130.04311.81
5.0.50.0000.04711.81
5.0.40.0000.04711.81
5.0.30.0000.05311.81
5.0.20.0000.04011.81
5.0.10.0070.04711.81
5.0.00.0000.05011.81
4.4.90.0000.02011.81
4.4.80.0070.03011.81
4.4.70.0030.02711.81
4.4.60.0030.03311.81
4.4.50.0070.01311.81
4.4.40.0030.04711.81
4.4.30.0030.03311.81
4.4.20.0030.03311.81
4.4.10.0030.01311.81
4.4.00.0000.03011.81
4.3.110.0030.03311.81
4.3.100.0030.02711.81
4.3.90.0070.02711.81
4.3.80.0030.04311.81
4.3.70.0070.02311.81
4.3.60.0030.02711.81
4.3.50.0070.02311.81
4.3.40.0000.04711.81
4.3.30.0000.01311.81
4.3.20.0100.02711.81
4.3.10.0000.01711.81
4.3.00.0030.03011.81

preferences:
49.33 ms | 401 KiB | 5 Q