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; for($n = 0; $n < 12; $n++) { $temp = $inbetween / $i[0] / $i[0] / $i[1]; var_dump($temp); $tempMonth = date('n', strtotime('-1 year', $second)) - 1; if($temp >= $i[5][$tempMonth]) { $temp -= $i[5][$tempMonth]; var_dump($temp); } else { $days = $temp; var_dump($days); 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 . " " . $days . " " . $hours . " " . $minutes . " " . $seconds . " " . $inbetween; } 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.60.0120.00918.55
8.3.50.0080.01221.39
8.3.40.0070.00718.77
8.3.30.0100.00320.28
8.3.20.0050.00320.30
8.3.10.0060.00321.05
8.3.00.0040.00422.45
8.2.180.0110.00717.00
8.2.170.0070.00722.96
8.2.160.0120.00322.21
8.2.150.0080.00024.18
8.2.140.0080.00024.66
8.2.130.0000.00726.16
8.2.120.0000.00821.06
8.2.110.0060.00319.30
8.2.100.0030.00918.16
8.2.90.0040.00419.30
8.2.80.0080.00018.18
8.2.70.0040.00417.88
8.2.60.0030.00617.93
8.2.50.0040.00418.07
8.2.40.0050.00318.46
8.2.30.0040.00419.55
8.2.20.0030.00618.04
8.2.10.0000.00818.11
8.2.00.0030.00518.20
8.1.280.0120.00625.92
8.1.270.0080.00024.10
8.1.260.0040.00426.35
8.1.250.0000.00728.09
8.1.240.0090.00023.92
8.1.230.0090.00320.93
8.1.220.0000.00818.77
8.1.210.0060.00320.99
8.1.200.0030.00617.25
8.1.190.0040.00417.65
8.1.180.0040.00418.10
8.1.170.0030.00518.91
8.1.160.0000.00719.00
8.1.150.0000.00818.92
8.1.140.0080.00017.74
8.1.130.0040.00417.99
8.1.120.0000.00717.67
8.1.110.0000.00717.72
8.1.100.0000.00717.77
8.1.90.0030.00617.66
8.1.80.0040.00417.64
8.1.70.0070.00017.72
8.1.60.0030.00517.79
8.1.50.0050.00317.70
8.1.40.0050.00317.64
8.1.30.0040.00417.87
8.1.20.0030.00617.78
8.1.10.0030.00517.85
8.1.00.0030.00517.87
8.0.300.0040.00420.18
8.0.290.0000.00717.41
8.0.280.0030.00318.52
8.0.270.0000.00717.34
8.0.260.0030.00317.06
8.0.250.0070.00017.23
8.0.240.0000.00917.27
8.0.230.0070.00017.31
8.0.220.0000.00717.12
8.0.210.0000.00817.27
8.0.200.0040.00417.17
8.0.190.0070.00017.32
8.0.180.0070.00017.27
8.0.170.0030.00517.29
8.0.160.0000.00717.26
8.0.150.0070.00017.25
8.0.140.0000.00817.04
8.0.130.0060.00013.64
8.0.120.0030.00517.22
8.0.110.0040.00417.11
8.0.100.0040.00417.20
8.0.90.0000.00717.12
8.0.80.0120.00317.22
8.0.70.0080.00017.22
8.0.60.0050.00217.24
8.0.50.0000.00717.11
8.0.30.0050.01517.42
8.0.20.0130.00817.51
8.0.10.0040.00417.24
8.0.00.0080.01217.02
7.4.330.0050.00016.75
7.4.320.0030.00316.67
7.4.300.0030.00316.69
7.4.290.0000.00816.81
7.4.280.0050.00316.80
7.4.270.0030.00316.86
7.4.260.0000.00513.32
7.4.250.0070.00016.64
7.4.240.0020.00516.66
7.4.230.0080.00016.59
7.4.220.0100.01716.68
7.4.210.0070.01016.79
7.4.200.0050.00316.86
7.4.190.0070.00016.64
7.4.160.0160.00716.62
7.4.150.0160.00317.40
7.4.140.0130.00717.86
7.4.130.0130.00316.80
7.4.120.0120.01216.77
7.4.110.0000.01816.91
7.4.100.0130.00716.96
7.4.90.0060.01416.77
7.4.80.0170.00619.39
7.4.70.0100.01016.68
7.4.60.0000.01716.79
7.4.50.0020.00216.90
7.4.40.0030.01322.77
7.4.30.0100.00616.93
7.4.10.0040.01515.23
7.4.00.0050.01115.38
7.3.330.0050.00013.45
7.3.320.0000.00513.46
7.3.310.0030.00316.41
7.3.300.0000.00916.59
7.3.290.0030.01416.52
7.3.280.0070.00916.53
7.3.270.0140.00417.40
7.3.260.0180.00318.24
7.3.250.0060.01216.86
7.3.240.0120.00616.73
7.3.230.0040.01316.71
7.3.210.0100.00716.71
7.3.200.0040.01519.39
7.3.190.0120.00916.65
7.3.180.0100.00616.85
7.3.170.0070.01016.76
7.3.160.0060.01116.76
7.3.130.0070.01315.05
7.3.120.0030.01315.19
7.3.110.0030.01414.88
7.3.100.0030.01014.88
7.3.90.0130.00314.99
7.3.80.0100.00715.29
7.3.70.0090.00615.13
7.3.60.0000.01814.79
7.3.50.0120.00015.20
7.3.40.0000.00815.16
7.3.30.0090.00315.03
7.3.20.0120.00016.76
7.3.10.0020.01116.77
7.3.00.0060.00716.79
7.2.330.0100.00716.78
7.2.320.0140.01117.07
7.2.310.0110.00717.03
7.2.300.0070.01117.03
7.2.290.0090.00917.05
7.2.260.0090.00915.27
7.2.250.0040.00815.38
7.2.240.0000.01415.32
7.2.230.0070.00715.12
7.2.220.0120.00315.30
7.2.210.0030.01615.47
7.2.200.0000.01515.38
7.2.190.0050.00515.52
7.2.180.0090.00615.44
7.2.170.0060.00315.42
7.2.160.0110.00715.36
7.2.150.0090.00617.11
7.2.140.0070.01017.07
7.2.130.0030.01017.19
7.2.120.0080.00717.27
7.2.110.0090.00617.11
7.2.100.0050.00816.98
7.2.90.0070.00417.19
7.2.80.0010.01317.33
7.2.70.0060.00817.32
7.2.60.0050.00917.11
7.2.50.0030.01217.21
7.2.40.0120.00217.03
7.2.30.0070.00817.11
7.2.20.0060.00817.17
7.2.10.0030.00817.10
7.2.00.0070.00617.89
7.1.330.0000.01415.93
7.1.320.0030.01115.61
7.1.310.0090.00616.11
7.1.300.0080.00015.89
7.1.290.0000.01115.99
7.1.280.0000.00815.95
7.1.270.0000.01116.11
7.1.260.0000.00916.13
7.1.250.0070.00516.12
7.1.240.0120.00316.08
7.1.230.0060.00616.11
7.1.220.0000.01116.15
7.1.210.0040.00716.05
7.1.200.0070.00816.18
7.1.190.0030.01015.79
7.1.180.0100.00316.24
7.1.170.0070.00716.14
7.1.160.0030.00916.00
7.1.150.0030.00616.04
7.1.140.0030.01016.23
7.1.130.0000.00815.97
7.1.120.0030.00916.16
7.1.110.0070.00416.21
7.1.100.0020.00917.36
7.1.90.0040.00716.15
7.1.80.0000.01415.84
7.1.70.0050.00816.62
7.1.60.0100.00817.66
7.1.50.0080.01016.53
7.1.40.0070.00716.20
7.1.30.0070.00715.87
7.1.20.0110.00015.88
7.1.10.0060.00916.14
7.1.00.0030.02219.11
7.0.330.0070.00715.67
7.0.320.0110.00415.41
7.0.310.0070.00715.63
7.0.300.0000.01115.52
7.0.290.0060.01215.43
7.0.280.0040.00415.40
7.0.270.0060.00315.48
7.0.260.0100.00315.54
7.0.250.0070.00715.44
7.0.240.0100.00315.63
7.0.230.0030.01315.70
7.0.220.0090.00615.68
7.0.210.0070.00715.59
7.0.200.0060.00416.24
7.0.190.0000.01315.66
7.0.180.0000.01515.65
7.0.170.0000.01315.68
7.0.160.0070.00715.54
7.0.150.0040.01215.71
7.0.140.0040.03818.69
7.0.130.0060.00315.69
7.0.120.0030.01015.50
7.0.110.0060.00615.70
7.0.100.0040.00815.67
7.0.90.0090.00015.61
7.0.80.0170.03017.78
7.0.70.0310.04317.80
7.0.60.0230.03117.83
7.0.50.0360.04217.96
7.0.40.0070.04516.79
7.0.30.0030.03216.87
7.0.20.0100.04416.90
7.0.10.0080.04616.77
7.0.00.0100.03716.94
5.6.400.0030.01014.56
5.6.390.0070.00714.69
5.6.380.0080.00414.27
5.6.370.0120.00314.48
5.6.360.0060.00914.82
5.6.350.0100.00314.76
5.6.340.0090.00614.66
5.6.330.0040.01114.32
5.6.320.0080.00414.68
5.6.310.0070.00714.64
5.6.300.0000.00914.61
5.6.290.0070.00714.69
5.6.280.0010.04017.74
5.6.270.0040.00714.51
5.6.260.0030.00614.75
5.6.250.0070.00714.73
5.6.240.0070.00714.65
5.6.230.0100.02717.71
5.6.220.0050.04517.78
5.6.210.0050.02517.61
5.6.200.0070.04717.94
5.6.190.0050.04317.89
5.6.180.0080.04617.78
5.6.170.0040.03317.91
5.6.160.0100.04517.90
5.6.150.0140.03817.69
5.6.140.0050.04717.98
5.6.130.0050.04817.85
5.6.120.0070.02817.86
5.6.110.0110.04517.82
5.6.100.0030.03817.87
5.6.90.0080.04217.81
5.6.80.0030.02517.42
5.6.70.0100.03717.45
5.6.60.0030.04117.39
5.6.50.0060.02817.32
5.6.40.0080.02217.42
5.6.30.0050.04117.52
5.6.20.0070.02717.47
5.6.10.0070.04217.41
5.6.00.0120.02017.44
5.5.380.0030.00614.65
5.5.370.0000.05117.30
5.5.360.0040.03017.60
5.5.350.0020.04617.59
5.5.340.0070.02217.73
5.5.330.0130.03817.73
5.5.320.0080.02817.88
5.5.310.0080.04117.69
5.5.300.0080.02517.71
5.5.290.0130.03717.71
5.5.280.0080.03817.59
5.5.270.0080.03117.59
5.5.260.0040.03417.70
5.5.250.0080.04217.67
5.5.240.0070.02517.25
5.5.230.0090.04217.40
5.5.220.0070.04317.33
5.5.210.0070.04217.43
5.5.200.0030.02717.29
5.5.190.0060.02517.47
5.5.180.0070.02417.27
5.5.170.0090.00614.40
5.5.160.0070.03017.51
5.5.150.0050.04317.41
5.5.140.0040.04117.29
5.5.130.0050.04317.21
5.5.120.0080.04317.30
5.5.110.0090.04117.34
5.5.100.0100.03817.28
5.5.90.0030.04317.15
5.5.80.0080.04217.19
5.5.70.0050.04717.45
5.5.60.0030.03017.30
5.5.50.0030.04217.36
5.5.40.0100.04217.20
5.5.30.0100.02617.44
5.5.20.0120.03717.25
5.5.10.0070.04117.16
5.5.00.0100.03817.15
5.4.450.0050.04716.47
5.4.440.0160.01916.49
5.4.430.0020.04716.43
5.4.420.0080.03816.39
5.4.410.0140.03616.38
5.4.400.0060.02116.37
5.4.390.0080.02516.30
5.4.380.0080.03016.21
5.4.370.0000.04516.33
5.4.360.0060.02416.31
5.4.350.0010.04716.38
5.4.340.0070.01816.30
5.4.330.0050.00313.52
5.4.320.0050.03716.37
5.4.310.0070.03816.35
5.4.300.0080.03516.19
5.4.290.0080.02216.36
5.4.280.0050.03316.23
5.4.270.0000.04616.36
5.4.260.0030.04016.30
5.4.250.0030.04616.19
5.4.240.0090.02016.23
5.4.230.0050.04016.35
5.4.220.0080.02316.32
5.4.210.0000.03216.32
5.4.200.0070.03316.28
5.4.190.0080.03916.35
5.4.180.0090.03716.32
5.4.170.0030.03016.20
5.4.160.0060.04016.27
5.4.150.0050.04516.24
5.4.140.0080.03515.00
5.4.130.0020.02815.01
5.4.120.0050.04015.03
5.4.110.0020.02715.03
5.4.100.0020.02314.92
5.4.90.0030.02815.00
5.4.80.0020.02914.96
5.4.70.0030.02514.99
5.4.60.0100.03514.98
5.4.50.0090.02714.98
5.4.40.0070.04214.95
5.4.30.0060.03914.94
5.4.20.0030.03314.89
5.4.10.0080.03414.92
5.4.00.0030.02314.74
5.3.290.0120.03914.15
5.3.280.0070.03514.14
5.3.270.0060.04414.11
5.3.260.0090.04514.03
5.3.250.0090.02214.10
5.3.240.0040.04314.03
5.3.230.0030.04414.03
5.3.220.0100.02214.10
5.3.210.0060.03314.05
5.3.200.0060.02614.07
5.3.190.0070.04314.01
5.3.180.0070.04014.12
5.3.170.0020.03714.10
5.3.160.0050.03714.01
5.3.150.0080.02514.04
5.3.140.0050.03314.02
5.3.130.0070.03114.04
5.3.120.0050.03814.10
5.3.110.0030.03014.04
5.3.100.0050.04313.86
5.3.90.0000.04913.77
5.3.80.0070.02513.74
5.3.70.0050.04013.74
5.3.60.0020.04413.77
5.3.50.0030.02513.77
5.3.40.0030.03113.72
5.3.30.0080.03813.69
5.3.20.0050.04013.65
5.3.10.0020.04313.60
5.3.00.0060.03713.54
5.2.170.0100.06011.05
5.2.160.0100.05711.08
5.2.150.0100.06011.19
5.2.140.0100.04011.07
5.2.130.0070.05311.17
5.2.120.0100.06011.18
5.2.110.0000.04310.98
5.2.100.0070.06011.17
5.2.90.0070.05711.05
5.2.80.0070.06011.19
5.2.70.0000.06311.27
5.2.60.0070.06011.06
5.2.50.0000.03311.18
5.2.40.0170.04010.92
5.2.30.0070.05711.04
5.2.20.0030.03711.10
5.2.10.0170.05010.81
5.2.00.0100.05310.84
5.1.60.0130.02010.73
5.1.50.0070.05010.73
5.1.40.0070.03310.73
5.1.30.0100.02710.73
5.1.20.0000.06010.73
5.1.10.0130.04710.73
5.1.00.0030.05310.73
5.0.50.0000.04310.73
5.0.40.0030.03310.73
5.0.30.0030.06010.73
5.0.20.0070.02710.73
5.0.10.0000.02310.73
5.0.00.0000.03310.73
4.4.90.0000.03710.73
4.4.80.0000.02010.73
4.4.70.0030.02710.73
4.4.60.0000.03710.73
4.4.50.0000.03710.73
4.4.40.0000.05710.73
4.4.30.0030.03010.73
4.4.20.0000.03710.73
4.4.10.0030.03010.73
4.4.00.0000.05310.73
4.3.110.0030.02710.73
4.3.100.0030.02710.73
4.3.90.0000.02010.73
4.3.80.0000.05710.73
4.3.70.0000.03310.73
4.3.60.0000.03710.73
4.3.50.0000.03710.73
4.3.40.0000.05710.73
4.3.30.0000.04010.73
4.3.20.0030.03310.73
4.3.10.0000.03310.73
4.3.00.0000.03010.73

preferences:
42.99 ms | 401 KiB | 5 Q