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; } var_dump($tempMonth); $tempMonth = $tempMonth < 10 ? $tempMonth + 1 : 0; } $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.60.0140.00718.81
8.3.50.0110.00621.20
8.3.40.0040.01119.07
8.3.30.0110.00320.29
8.3.20.0070.00020.29
8.3.10.0040.00421.27
8.3.00.0080.00022.55
8.2.180.0170.00317.00
8.2.170.0110.00422.96
8.2.160.0080.00822.38
8.2.150.0040.00424.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0080.00020.98
8.2.110.0030.00619.42
8.2.100.0110.00018.16
8.2.90.0050.00319.51
8.2.80.0030.00617.97
8.2.70.0090.00018.00
8.2.60.0080.00018.05
8.2.50.0030.00718.07
8.2.40.0040.00418.15
8.2.30.0040.00419.56
8.2.20.0030.00618.02
8.2.10.0090.00018.15
8.2.00.0000.00918.08
8.1.280.0110.00625.92
8.1.270.0040.00423.99
8.1.260.0080.00026.35
8.1.250.0070.00028.09
8.1.240.0070.00424.02
8.1.230.0040.00720.97
8.1.220.0000.00818.77
8.1.210.0000.00819.20
8.1.200.0030.00617.60
8.1.190.0090.00017.54
8.1.180.0000.00818.10
8.1.170.0040.00418.83
8.1.160.0040.00419.08
8.1.150.0030.00518.98
8.1.140.0050.00317.85
8.1.130.0000.00718.09
8.1.120.0040.00417.88
8.1.110.0040.00417.68
8.1.100.0040.00417.79
8.1.90.0030.00517.87
8.1.80.0000.00717.71
8.1.70.0000.00817.73
8.1.60.0040.00417.91
8.1.50.0030.00517.75
8.1.40.0040.00417.63
8.1.30.0090.00017.89
8.1.20.0040.00417.87
8.1.10.0000.00717.90
8.1.00.0030.00517.75
8.0.300.0070.00020.30
8.0.290.0000.00817.54
8.0.280.0000.00818.58
8.0.270.0000.00717.49
8.0.260.0040.00417.17
8.0.250.0070.00017.42
8.0.240.0000.00817.21
8.0.230.0050.00317.24
8.0.220.0040.00417.34
8.0.210.0040.00417.19
8.0.200.0060.00017.38
8.0.190.0040.00417.41
8.0.180.0000.00717.22
8.0.170.0080.00017.23
8.0.160.0030.00317.36
8.0.150.0040.00417.20
8.0.140.0040.00417.18
8.0.130.0060.00013.66
8.0.120.0080.00017.25
8.0.110.0000.00717.20
8.0.100.0040.00417.26
8.0.90.0000.00717.32
8.0.80.0100.00717.23
8.0.70.0040.00417.09
8.0.60.0040.00417.38
8.0.50.0000.00717.31
8.0.30.0120.00717.27
8.0.20.0130.00617.45
8.0.10.0000.00817.41
8.0.00.0140.00517.19
7.4.330.0000.00516.77
7.4.320.0030.00316.79
7.4.300.0000.00616.79
7.4.290.0000.00716.72
7.4.280.0030.00316.74
7.4.270.0030.00316.75
7.4.260.0000.00713.50
7.4.250.0040.00416.84
7.4.240.0030.00316.84
7.4.230.0030.00316.99
7.4.220.0070.01716.72
7.4.210.0050.01216.81
7.4.200.0030.00316.65
7.4.190.0040.00416.98
7.4.160.0120.00416.71
7.4.150.0090.00917.40
7.4.140.0130.00617.86
7.4.130.0110.01016.85
7.4.120.0110.00816.86
7.4.110.0130.00316.94
7.4.100.0180.00417.02
7.4.90.0060.01016.85
7.4.80.0150.00619.39
7.4.70.0120.00317.01
7.4.60.0090.00916.72
7.4.50.0030.00516.92
7.4.40.0090.00622.77
7.4.30.0150.00716.66
7.4.10.0090.00915.21
7.4.00.0070.00815.30
7.3.330.0050.00013.60
7.3.320.0050.00013.62
7.3.310.0070.00016.65
7.3.300.0070.00016.60
7.3.290.0130.00716.59
7.3.280.0100.00716.62
7.3.270.0070.01017.40
7.3.260.0080.01618.24
7.3.250.0120.00716.83
7.3.240.0060.01016.72
7.3.230.0130.00616.79
7.3.210.0130.01016.75
7.3.200.0040.01519.39
7.3.190.0080.01216.78
7.3.180.0120.00916.74
7.3.170.0100.00616.70
7.3.160.0110.00616.88
7.3.130.0060.01215.32
7.3.120.0020.01515.10
7.3.110.0070.01015.14
7.3.100.0080.00914.96
7.3.90.0110.00415.16
7.3.80.0100.00815.29
7.3.70.0070.01015.01
7.3.60.0030.01215.14
7.3.50.0050.00915.15
7.3.40.0070.00715.11
7.3.30.0100.00615.02
7.3.20.0060.00816.80
7.3.10.0060.00817.05
7.3.00.0050.00816.74
7.2.330.0150.00416.93
7.2.320.0110.01116.98
7.2.310.0060.01216.89
7.2.300.0120.00917.09
7.2.290.0130.00316.91
7.2.260.0030.01415.34
7.2.250.0050.01115.17
7.2.240.0070.01015.25
7.2.230.0080.00515.54
7.2.220.0080.00515.41
7.2.210.0060.00715.21
7.2.200.0100.00515.33
7.2.190.0100.00615.43
7.2.180.0080.00515.22
7.2.170.0040.00915.30
7.2.160.0120.00515.08
7.2.150.0040.00917.04
7.2.140.0030.01117.00
7.2.130.0090.00317.24
7.2.120.0080.00717.17
7.2.110.0050.00617.22
7.2.100.0040.00817.05
7.2.90.0070.00817.26
7.2.80.0070.00617.11
7.2.70.0080.00717.09
7.2.60.0080.01017.33
7.2.50.0070.00917.15
7.2.40.0100.00517.25
7.2.30.0080.00817.26
7.2.20.0070.00617.00
7.2.10.0040.01117.24
7.2.00.0050.00817.77
7.1.330.0090.00515.94
7.1.320.0060.00515.79
7.1.310.0060.00415.82
7.1.300.0010.01216.02
7.1.290.0030.00816.17
7.1.280.0090.00416.19
7.1.270.0090.00715.84
7.1.260.0050.00716.12
7.1.250.0090.00516.13
7.1.240.0060.00715.90
7.1.230.0020.01116.15
7.1.220.0100.00416.07
7.1.210.0030.01216.12
7.1.200.0060.00816.02
7.1.190.0040.01115.84
7.1.180.0090.00816.00
7.1.170.0080.00316.10
7.1.160.0080.00415.87
7.1.150.0020.01115.92
7.1.140.0060.00616.03
7.1.130.0050.00815.90
7.1.120.0020.01616.20
7.1.110.0040.00916.02
7.1.100.0060.00816.73
7.1.90.0100.00515.86
7.1.80.0050.01015.99
7.1.70.0030.00916.32
7.1.60.0080.00717.03
7.1.50.0030.01016.44
7.1.40.0050.01016.13
7.1.30.0030.01116.10
7.1.20.0060.00716.11
7.1.10.0040.00715.97
7.1.00.0010.02418.14
7.0.330.0060.00915.57
7.0.320.0070.00515.66
7.0.310.0050.00815.32
7.0.300.0110.00315.63
7.0.290.0020.01215.38
7.0.280.0050.00715.59
7.0.270.0080.00515.53
7.0.260.0100.00315.49
7.0.250.0070.00715.51
7.0.240.0050.00915.67
7.0.230.0060.00715.69
7.0.220.0050.00815.68
7.0.210.0050.00715.70
7.0.200.0070.00315.98
7.0.190.0030.01015.73
7.0.180.0030.01115.67
7.0.170.0070.00715.64
7.0.160.0030.00815.64
7.0.150.0050.01015.56
7.0.140.0060.02717.76
7.0.130.0050.00815.54
7.0.120.0040.00715.64
7.0.110.0050.00815.42
7.0.100.0030.01015.59
7.0.90.0090.00515.65
7.0.80.0250.03317.09
7.0.70.0220.01916.93
7.0.60.0240.02716.92
7.0.50.0170.02217.30
7.0.40.0090.03015.77
7.0.30.0060.03415.74
7.0.20.0070.03515.73
7.0.10.0060.03315.81
7.0.00.0100.02815.86
5.6.400.0050.00814.53
5.6.390.0050.00914.75
5.6.380.0030.01114.71
5.6.370.0060.00714.58
5.6.360.0050.00814.72
5.6.350.0060.00814.80
5.6.340.0030.00914.57
5.6.330.0100.00514.63
5.6.320.0070.00714.42
5.6.310.0050.01114.87
5.6.300.0040.00914.70
5.6.290.0050.01114.54
5.6.280.0070.02616.72
5.6.270.0040.00814.68
5.6.260.0050.00814.74
5.6.250.0070.00314.70
5.6.240.0100.00314.61
5.6.230.0090.01716.63
5.6.220.0060.03416.67
5.6.210.0100.02916.78
5.6.200.0090.03216.75
5.6.190.0060.02816.78
5.6.180.0100.03116.79
5.6.170.0060.03716.83
5.6.160.0040.02616.84
5.6.150.0020.03316.77
5.6.140.0090.02716.68
5.6.130.0080.03216.86
5.6.120.0060.03116.78
5.6.110.0090.02816.82
5.6.100.0120.01916.82
5.6.90.0100.03116.73
5.6.80.0080.03016.60
5.6.70.0050.03316.54
5.6.60.0060.02916.56
5.6.50.0080.02016.54
5.6.40.0060.03216.49
5.6.30.0090.02316.47
5.6.20.0070.03016.55
5.6.10.0120.01716.57
5.6.00.0060.03016.51
5.5.380.0070.00714.60
5.5.370.0060.03116.48
5.5.360.0060.03516.64
5.5.350.0040.02716.37
5.5.340.0090.03116.63
5.5.330.0080.03416.68
5.5.320.0080.03116.67
5.5.310.0090.03016.79
5.5.300.0130.02716.65
5.5.290.0050.03416.53
5.5.280.0070.03416.62
5.5.270.0090.02916.72
5.5.260.0050.02316.50
5.5.250.0120.02816.58
5.5.240.0080.03116.37
5.5.230.0060.03016.48
5.5.220.0060.02716.42
5.5.210.0090.02916.37
5.5.200.0060.02616.52
5.5.190.0090.02816.41
5.5.180.0030.02316.44
5.5.170.0060.00714.37
5.5.160.0050.03216.35
5.5.150.0020.03316.50
5.5.140.0070.03116.54
5.5.130.0100.02616.44
5.5.120.0090.02616.34
5.5.110.0060.01916.35
5.5.100.0050.01916.39
5.5.90.0040.02116.42
5.5.80.0120.02716.32
5.5.70.0110.02516.33
5.5.60.0080.02616.38
5.5.50.0060.03016.50
5.5.40.0030.03216.27
5.5.30.0070.02916.27
5.5.20.0110.02116.39
5.5.10.0040.02916.16
5.5.00.0060.03416.18
5.4.450.0040.03214.63
5.4.440.0040.03314.69
5.4.430.0080.02414.60
5.4.420.0060.03214.71
5.4.410.0080.02914.62
5.4.400.0030.02814.55
5.4.390.0040.02614.62
5.4.380.0070.02514.57
5.4.370.0090.02314.60
5.4.360.0090.03414.56
5.4.350.0050.02314.58
5.4.340.0050.01714.60
5.4.330.0050.00512.31
5.4.320.0040.03114.56
5.4.310.0050.02614.54
5.4.300.0060.02714.56
5.4.290.0050.03214.51
5.4.280.0040.03014.53
5.4.270.0050.01814.51
5.4.260.0050.01614.60
5.4.250.0040.03314.62
5.4.240.0100.02414.59
5.4.230.0070.02814.58
5.4.220.0010.02214.49
5.4.210.0010.03614.55
5.4.200.0050.03214.56
5.4.190.0050.02914.55
5.4.180.0050.03014.51
5.4.170.0080.02614.61
5.4.160.0060.02314.58
5.4.150.0010.03114.55
5.4.140.0030.02813.70
5.4.130.0020.01813.70
5.4.120.0050.01813.71
5.4.110.0020.02013.67
5.4.100.0070.02013.65
5.4.90.0040.02313.68
5.4.80.0060.02613.70
5.4.70.0080.02413.72
5.4.60.0020.02913.70
5.4.50.0080.02413.63
5.4.40.0080.02713.67
5.4.30.0020.02513.67
5.4.20.0010.02313.64
5.4.10.0080.01913.65
5.4.00.0070.02413.49
5.3.290.0010.02613.13
5.3.280.0060.02613.10
5.3.270.0060.03113.11
5.3.260.0030.02613.09
5.3.250.0050.01513.12
5.3.240.0060.02613.10
5.3.230.0020.01813.08
5.3.220.0090.01213.12
5.3.210.0040.03113.06
5.3.200.0070.02713.09
5.3.190.0050.02813.08
5.3.180.0050.02713.10
5.3.170.0060.02613.10
5.3.160.0070.02413.08
5.3.150.0020.02013.06
5.3.140.0050.02913.10
5.3.130.0010.02213.06
5.3.120.0040.03213.06
5.3.110.0090.01513.08
5.3.100.0090.02012.92
5.3.90.0070.02312.89
5.3.80.0070.02712.86
5.3.70.0030.03112.93
5.3.60.0050.03112.90
5.3.50.0070.02912.91
5.3.40.0040.02912.86
5.3.30.0020.03012.87
5.3.20.0050.03012.83
5.3.10.0040.02112.80
5.3.00.0050.02412.79
5.2.170.0070.05711.30
5.2.160.0070.06011.22
5.2.150.0170.05311.19
5.2.140.0070.06711.30
5.2.130.0000.07011.05
5.2.120.0030.06011.05
5.2.110.0030.06011.23
5.2.100.0000.04711.01
5.2.90.0070.05711.25
5.2.80.0070.04311.15
5.2.70.0030.04011.17
5.2.60.0030.06310.93
5.2.50.0100.05711.03
5.2.40.0030.04011.09
5.2.30.0030.03011.11
5.2.20.0030.06711.04
5.2.10.0030.05710.89
5.2.00.0070.05310.69
5.1.60.0130.04710.10
5.1.50.0070.05710.02
5.1.40.0070.05310.09
5.1.30.0070.05310.31
5.1.20.0030.05010.36
5.1.10.0030.05010.16
5.1.00.0070.04010.08
5.0.50.0000.0408.66
5.0.40.0000.0408.52
5.0.30.0030.0608.34
5.0.20.0100.0338.32
5.0.10.0030.0408.29
5.0.00.0030.0638.04
4.4.90.0000.0337.16
4.4.80.0000.0307.16
4.4.70.0030.0307.16
4.4.60.0000.0377.16
4.4.50.0000.0377.16
4.4.40.0070.0507.16
4.4.30.0030.0377.16
4.4.20.0000.0407.16
4.4.10.0070.0337.16
4.4.00.0030.0537.16
4.3.110.0000.0277.16
4.3.100.0030.0377.16
4.3.90.0030.0277.16
4.3.80.0000.0577.16
4.3.70.0000.0377.16
4.3.60.0000.0337.16
4.3.50.0030.0337.16
4.3.40.0030.0407.16
4.3.30.0000.0377.16
4.3.20.0070.0237.16
4.3.10.0000.0377.16
4.3.00.0070.0337.16

preferences:
51.81 ms | 401 KiB | 5 Q