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++) { 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.60.0150.00318.55
8.3.50.0110.00721.27
8.3.40.0000.01518.91
8.3.30.0030.01020.52
8.3.20.0040.00420.16
8.3.10.0040.00421.22
8.3.00.0080.00022.63
8.2.180.0100.01017.00
8.2.170.0040.01122.96
8.2.160.0100.00722.33
8.2.150.0090.00024.18
8.2.140.0050.00324.66
8.2.130.0080.00026.16
8.2.120.0030.00621.08
8.2.110.0030.00619.30
8.2.100.0040.00818.03
8.2.90.0040.00419.47
8.2.80.0080.00018.30
8.2.70.0030.00617.86
8.2.60.0080.00018.18
8.2.50.0050.00518.07
8.2.40.0050.00318.59
8.2.30.0040.00419.66
8.2.20.0040.00418.09
8.2.10.0000.00918.23
8.2.00.0030.00518.22
8.1.280.0090.00625.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0050.00328.09
8.1.240.0000.00924.09
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.0050.00317.88
8.1.180.0090.00018.10
8.1.170.0040.00418.88
8.1.160.0030.00619.16
8.1.150.0050.00318.99
8.1.140.0080.00017.82
8.1.130.0000.00718.05
8.1.120.0050.00217.86
8.1.110.0070.00017.82
8.1.100.0040.00417.79
8.1.90.0040.00417.73
8.1.80.0040.00417.77
8.1.70.0070.00017.70
8.1.60.0030.00617.76
8.1.50.0030.00517.79
8.1.40.0000.01017.80
8.1.30.0050.00317.85
8.1.20.0030.00617.94
8.1.10.0000.00917.81
8.1.00.0000.00717.89
8.0.300.0040.00420.32
8.0.290.0040.00417.42
8.0.280.0080.00018.70
8.0.270.0030.00317.45
8.0.260.0030.00317.19
8.0.250.0070.00017.44
8.0.240.0040.00417.23
8.0.230.0030.00617.32
8.0.220.0040.00417.30
8.0.210.0080.00017.37
8.0.200.0070.00017.36
8.0.190.0000.00717.38
8.0.180.0080.00017.27
8.0.170.0040.00417.36
8.0.160.0080.00017.41
8.0.150.0040.00417.16
8.0.140.0070.00017.28
8.0.130.0000.00713.60
8.0.120.0080.00017.24
8.0.110.0000.00917.21
8.0.100.0050.00317.32
8.0.90.0000.00817.09
8.0.80.0030.01717.30
8.0.70.0040.00417.22
8.0.60.0000.00717.20
8.0.50.0050.00217.28
8.0.30.0120.00917.36
8.0.20.0110.00817.42
8.0.10.0080.00017.29
8.0.00.0090.01117.08
7.4.330.0030.00316.83
7.4.320.0030.00316.79
7.4.300.0030.00316.81
7.4.290.0040.00416.91
7.4.280.0000.00816.88
7.4.270.0000.00716.79
7.4.260.0080.00013.52
7.4.250.0030.00616.84
7.4.240.0010.00616.83
7.4.230.0070.00016.79
7.4.220.0090.00916.96
7.4.210.0090.00816.84
7.4.200.0000.00716.90
7.4.190.0040.00416.85
7.4.160.0110.00916.88
7.4.150.0080.00917.40
7.4.140.0090.00817.86
7.4.130.0130.00616.85
7.4.120.0080.00916.82
7.4.110.0100.00716.83
7.4.100.0100.00716.70
7.4.90.0090.00916.97
7.4.80.0060.01319.39
7.4.70.0060.00916.84
7.4.60.0070.01016.80
7.4.50.0030.00516.71
7.4.40.0100.00322.77
7.4.30.0090.00916.95
7.4.10.0070.01114.96
7.4.00.0090.00815.16
7.3.330.0000.00513.67
7.3.320.0000.00513.67
7.3.310.0040.00416.70
7.3.300.0060.00316.72
7.3.290.0040.01116.64
7.3.280.0090.01016.69
7.3.270.0120.00917.40
7.3.260.0100.01418.24
7.3.250.0070.01016.80
7.3.240.0090.00916.95
7.3.230.0090.00816.90
7.3.210.0000.01716.77
7.3.200.0030.01519.39
7.3.190.0100.00716.82
7.3.180.0130.00316.95
7.3.170.0130.00316.78
7.3.160.0120.00616.85
7.3.130.0140.00415.14
7.3.120.0060.01015.09
7.3.110.0070.01015.16
7.3.100.0070.00615.26
7.3.90.0080.00615.17
7.3.80.0040.00715.19
7.3.70.0080.00314.94
7.3.60.0070.01015.15
7.3.50.0050.00715.18
7.3.40.0060.00715.17
7.3.30.0060.00815.23
7.3.20.0050.00816.89
7.3.10.0070.00917.02
7.3.00.0080.00316.96
7.2.330.0130.00916.94
7.2.320.0030.01317.08
7.2.310.0130.01016.84
7.2.300.0130.00417.20
7.2.290.0160.00317.02
7.2.260.0100.01015.29
7.2.250.0100.00815.28
7.2.240.0070.00915.34
7.2.230.0080.00715.18
7.2.220.0050.01015.50
7.2.210.0060.00815.61
7.2.200.0050.01115.36
7.2.190.0030.01115.30
7.2.180.0100.00315.38
7.2.170.0020.01415.26
7.2.160.0040.01115.38
7.2.150.0080.01117.21
7.2.140.0070.01117.01
7.2.130.0040.01117.22
7.2.120.0000.01117.24
7.2.110.0000.01117.16
7.2.100.0070.00317.14
7.2.90.0070.01017.22
7.2.80.0060.00917.29
7.2.70.0070.01017.33
7.2.60.0060.00617.15
7.2.50.0060.00317.11
7.2.40.0040.00717.32
7.2.30.0130.00317.33
7.2.20.0150.00017.18
7.2.10.0040.01117.29
7.2.00.0070.00618.45
7.1.330.0090.00516.17
7.1.320.0070.00616.01
7.1.310.0030.00916.02
7.1.300.0090.00615.81
7.1.290.0060.00616.03
7.1.280.0040.00615.89
7.1.270.0090.00515.90
7.1.260.0070.00716.09
7.1.250.0120.00315.78
7.1.240.0030.01016.20
7.1.230.0040.01116.18
7.1.220.0070.00415.96
7.1.210.0090.00615.66
7.1.200.0120.00316.01
7.1.190.0080.00416.15
7.1.180.0030.00616.09
7.1.170.0000.01016.16
7.1.160.0060.00616.03
7.1.150.0090.00616.07
7.1.140.0000.00915.87
7.1.130.0030.00916.16
7.1.120.0070.00716.17
7.1.110.0060.00615.89
7.1.100.0040.00917.39
7.1.90.0060.00616.22
7.1.80.0000.01316.06
7.1.70.0020.01116.61
7.1.60.0100.00617.56
7.1.50.0090.01016.65
7.1.40.0040.01115.73
7.1.30.0030.01016.09
7.1.20.0040.00816.16
7.1.10.0000.01116.19
7.1.00.0090.02219.19
7.0.330.0030.01015.52
7.0.320.0080.00415.58
7.0.310.0090.00615.53
7.0.300.0030.01015.46
7.0.290.0140.00015.70
7.0.280.0120.00315.38
7.0.270.0060.00615.62
7.0.260.0110.00015.53
7.0.250.0060.00815.77
7.0.240.0030.00915.66
7.0.230.0100.00715.51
7.0.220.0090.00615.67
7.0.210.0100.00515.25
7.0.200.0070.00516.41
7.0.190.0030.00915.40
7.0.180.0080.00415.69
7.0.170.0040.00715.47
7.0.160.0030.00515.46
7.0.150.0050.00515.69
7.0.140.0030.03918.71
7.0.130.0080.00315.67
7.0.120.0060.00315.56
7.0.110.0030.00915.39
7.0.100.0030.00915.26
7.0.90.0000.01215.61
7.0.80.0280.02817.81
7.0.70.0320.04017.72
7.0.60.0360.03817.77
7.0.50.0320.04318.00
7.0.40.0070.04316.73
7.0.30.0050.03616.82
7.0.20.0050.04616.87
7.0.10.0030.04316.89
7.0.00.0120.02716.90
5.6.400.0030.00614.91
5.6.390.0060.00314.73
5.6.380.0030.01414.16
5.6.370.0100.00314.46
5.6.360.0030.00914.73
5.6.350.0040.01114.92
5.6.340.0040.01214.58
5.6.330.0030.01214.83
5.6.320.0120.00314.45
5.6.310.0110.00514.75
5.6.300.0030.00714.48
5.6.290.0090.00314.62
5.6.280.0020.04317.95
5.6.270.0080.00014.35
5.6.260.0000.01014.58
5.6.250.0000.01214.80
5.6.240.0100.00614.92
5.6.230.0020.04617.57
5.6.220.0130.02717.56
5.6.210.0100.04017.55
5.6.200.0120.03517.87
5.6.190.0070.04117.76
5.6.180.0080.04017.89
5.6.170.0120.04117.78
5.6.160.0090.04217.84
5.6.150.0100.03217.78
5.6.140.0050.02817.70
5.6.130.0050.04617.90
5.6.120.0100.03817.80
5.6.110.0020.04917.87
5.6.100.0070.04917.79
5.6.90.0100.02217.95
5.6.80.0020.02717.56
5.6.70.0050.02517.50
5.6.60.0070.02717.42
5.6.50.0030.02517.41
5.6.40.0050.02517.51
5.6.30.0070.02017.35
5.6.20.0030.03217.41
5.6.10.0040.02717.43
5.6.00.0080.01717.51
5.5.380.0040.00814.64
5.5.370.0080.02517.63
5.5.360.0090.04017.41
5.5.350.0120.03317.69
5.5.340.0040.02617.74
5.5.330.0120.03717.81
5.5.320.0070.04617.72
5.5.310.0080.04417.61
5.5.300.0120.03817.59
5.5.290.0070.04917.78
5.5.280.0050.04717.59
5.5.270.0110.04517.66
5.5.260.0090.04617.57
5.5.250.0040.02917.70
5.5.240.0020.02517.46
5.5.230.0040.02617.26
5.5.220.0050.02317.47
5.5.210.0050.02317.49
5.5.200.0080.02317.31
5.5.190.0010.02617.24
5.5.180.0070.02217.33
5.5.170.0100.00314.56
5.5.160.0040.02417.48
5.5.150.0020.02817.43
5.5.140.0050.01817.38
5.5.130.0090.01817.41
5.5.120.0020.02817.26
5.5.110.0050.02717.21
5.5.100.0040.02517.41
5.5.90.0090.01717.23
5.5.80.0060.02217.35
5.5.70.0070.02817.32
5.5.60.0050.02417.27
5.5.50.0040.02617.34
5.5.40.0080.01617.18
5.5.30.0080.01717.32
5.5.20.0050.02317.36
5.5.10.0030.02717.14
5.5.00.0030.02717.24
5.4.450.0060.04315.26
5.4.440.0090.04215.46
5.4.430.0100.03715.51
5.4.420.0050.03015.40
5.4.410.0030.02415.42
5.4.400.0030.02315.33
5.4.390.0070.02215.29
5.4.380.0030.04315.17
5.4.370.0030.02415.11
5.4.360.0050.02215.13
5.4.350.0050.02015.04
5.4.340.0020.02615.29
5.4.330.0030.00611.29
5.4.320.0020.02215.16
5.4.310.0030.02215.31
5.4.300.0060.01815.22
5.4.290.0030.01815.22
5.4.280.0050.02015.19
5.4.270.0080.03615.16
5.4.260.0050.02515.36
5.4.250.0000.02615.28
5.4.240.0030.02515.35
5.4.230.0040.02115.31
5.4.220.0060.02815.29
5.4.210.0090.01715.05
5.4.200.0070.01815.09
5.4.190.0040.01915.14
5.4.180.0060.02115.15
5.4.170.0020.02815.29
5.4.160.0020.02215.00
5.4.150.0030.02315.18
5.4.140.0050.02113.88
5.4.130.0050.02113.93
5.4.120.0050.02313.95
5.4.110.0020.02214.00
5.4.100.0070.02113.81
5.4.90.0050.01713.97
5.4.80.0060.01713.93
5.4.70.0070.01813.92
5.4.60.0050.04013.76
5.4.50.0050.02713.97
5.4.40.0070.03813.96
5.4.30.0050.02513.76
5.4.20.0080.03813.91
5.4.10.0050.04213.88
5.4.00.0000.03113.54
5.3.290.0000.02212.91
5.3.280.0030.02812.76
5.3.270.0050.02112.79
5.3.260.0050.02212.81
5.3.250.0020.02412.65
5.3.240.0030.02312.76
5.3.230.0090.01612.74
5.3.220.0050.01812.72
5.3.210.0030.02412.77
5.3.200.0040.02012.62
5.3.190.0030.02312.77
5.3.180.0030.01812.88
5.3.170.0030.01812.79
5.3.160.0030.04312.79
5.3.150.0050.02412.75
5.3.140.0070.03312.60
5.3.130.0050.03912.61
5.3.120.0050.03012.88
5.3.110.0060.02212.75
5.3.100.0050.04112.56
5.3.90.0050.03812.46
5.3.80.0080.02012.49
5.3.70.0070.03812.38
5.3.60.0090.03712.41
5.3.50.0100.03512.42
5.3.40.0100.03312.46
5.3.30.0100.03512.31
5.3.20.0050.03812.11
5.3.10.0040.03912.14
5.3.00.0030.04012.17
5.2.170.0070.06011.16
5.2.160.0030.05711.22
5.2.150.0030.05711.07
5.2.140.0070.04011.27
5.2.130.0030.05311.05
5.2.120.0070.04311.15
5.2.110.0070.05311.14
5.2.100.0000.06711.26
5.2.90.0000.05711.24
5.2.80.0030.06711.04
5.2.70.0030.05011.17
5.2.60.0000.06311.17
5.2.50.0070.06010.97
5.2.40.0070.04711.11
5.2.30.0070.03710.91
5.2.20.0100.05710.84
5.2.10.0030.06010.80
5.2.00.0100.05310.84
5.1.60.0070.03710.55
5.1.50.0070.04310.55
5.1.40.0070.04310.55
5.1.30.0100.04710.55
5.1.20.0070.04710.55
5.1.10.0030.04710.55
5.1.00.0100.05010.55
5.0.50.0070.04310.55
5.0.40.0030.04310.55
5.0.30.0030.07010.55
5.0.20.0100.03710.55
5.0.10.0100.03710.55
5.0.00.0030.06310.55
4.4.90.0070.03310.55
4.4.80.0030.03310.55
4.4.70.0070.03010.55
4.4.60.0070.03010.55
4.4.50.0000.03710.55
4.4.40.0030.05310.55
4.4.30.0070.02710.55
4.4.20.0070.03010.55
4.4.10.0000.03710.55
4.4.00.0000.05310.55
4.3.110.0070.03010.55
4.3.100.0000.03710.55
4.3.90.0030.03310.55
4.3.80.0070.03710.55
4.3.70.0070.01710.55
4.3.60.0070.01710.55
4.3.50.0030.03010.55
4.3.40.0030.04710.55
4.3.30.0000.04010.55
4.3.20.0000.04010.55
4.3.10.0030.03310.55
4.3.00.0000.03710.55

preferences:
39.74 ms | 401 KiB | 5 Q