3v4l.org

run code in 300+ PHP versions simultaneously
<?php function dateDiff($startdate, $enddate) { $first = $startdate < $enddate ? $startdate : $enddate; $second = $startdate < $enddate ? $enddate : $startdate; $inbetween = $second - $first; $i[0] = 60; $i[1] = 24; $i[2] = array(31, (date('L', strtotime('-1 year', $second)) ? 28 : 29), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31); $months = 0; $days = 0; $tempDays = $inbetween / $i[0] / $i[0] / $i[1] % 365.25; var_dump($tempDays); $tempMonth = date('n', strtotime('-1 year', $second)) - 1; for($n = 0; $n < 12; $n++) { if($tempDays >= $i[2][$tempMonth]) { $months += 1; $tempDays -= $i[2][$tempMonth]; } else { $days = round($tempDays); break; } $tempMonth = $tempMonth < 10 ? $tempMonth + 1 : 0; } $years = floor(date('Y', $second) - date('Y', $first) + $months / 12); $months = $months % 12; $hours = floor($inbetween / $i[0] / $i[0] % $i[1]); $minutes = floor($inbetween / $i[0] % $i[0]); $seconds = $inbetween % $i[0]; $dateObj = new stdClass(); $dateObj->years = $years; $dateObj->months = $months; $dateObj->days = $days; $dateObj->hours = $hours; $dateObj->minutes = $minutes; $dateObj->seconds = $seconds; return $dateObj; } $mydate = dateDiff(1388534400, 1451606400); echo $mydate->years, " years, ", $mydate->months, " months, ", $mydate->days, " days, ", $mydate->hours, " hours, ", $mydate->minutes, " minutes, and ", $mydate->seconds, " seconds";

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.0100.00718.55
8.3.50.0240.01021.39
8.3.40.0140.00019.04
8.3.30.0120.00320.09
8.3.20.0040.00420.30
8.3.10.0080.00021.92
8.3.00.0050.00322.57
8.2.180.0140.00716.75
8.2.170.0090.00622.96
8.2.160.0100.00322.21
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00420.87
8.2.110.0040.00922.10
8.2.100.0080.00418.28
8.2.90.0040.00419.33
8.2.80.0030.00619.31
8.2.70.0000.00818.00
8.2.60.0060.00318.05
8.2.50.0000.00918.07
8.2.40.0040.00418.15
8.2.30.0000.00819.55
8.2.20.0050.00317.96
8.2.10.0050.00318.11
8.2.00.0070.00018.18
8.1.280.0140.00725.92
8.1.270.0100.00023.99
8.1.260.0030.00526.35
8.1.250.0050.00328.09
8.1.240.0060.00323.92
8.1.230.0070.00421.03
8.1.220.0040.00417.93
8.1.210.0040.00418.77
8.1.200.0000.00917.73
8.1.190.0050.00317.78
8.1.180.0030.00618.10
8.1.170.0000.00918.90
8.1.160.0050.00219.12
8.1.150.0040.00418.86
8.1.140.0050.00317.80
8.1.130.0030.00318.05
8.1.120.0050.00217.66
8.1.110.0000.00717.73
8.1.100.0050.00317.73
8.1.90.0000.00717.75
8.1.80.0020.00517.66
8.1.70.0070.00017.75
8.1.60.0090.00017.76
8.1.50.0040.00417.66
8.1.40.0040.00417.69
8.1.30.0050.00317.93
8.1.20.0040.00417.88
8.1.10.0030.00517.71
8.1.00.0050.00317.78
8.0.300.0000.00818.77
8.0.290.0040.00417.29
8.0.280.0050.00318.55
8.0.270.0070.00017.48
8.0.260.0030.00317.19
8.0.250.0070.00017.40
8.0.240.0040.00417.30
8.0.230.0030.00317.35
8.0.220.0050.00217.19
8.0.210.0000.00817.33
8.0.200.0030.00317.21
8.0.190.0050.00317.29
8.0.180.0060.00317.18
8.0.170.0000.00917.32
8.0.160.0040.00417.32
8.0.150.0000.00717.10
8.0.140.0040.00417.27
8.0.130.0060.00013.62
8.0.120.0000.00817.11
8.0.110.0040.00417.17
8.0.100.0040.00417.13
8.0.90.0080.00017.33
8.0.80.0090.00617.33
8.0.70.0030.00517.20
8.0.60.0000.00817.26
8.0.50.0030.00617.32
8.0.30.0120.00817.33
8.0.20.0110.00817.59
8.0.10.0070.00017.22
8.0.00.0080.01317.12
7.4.330.0000.00516.75
7.4.320.0030.00316.86
7.4.300.0030.00316.61
7.4.290.0000.00816.72
7.4.280.0020.00516.75
7.4.270.0000.00716.67
7.4.260.0000.00613.40
7.4.250.0000.00716.62
7.4.240.0040.00416.80
7.4.230.0030.00316.92
7.4.220.0070.01316.89
7.4.210.0090.00816.76
7.4.200.0000.00816.95
7.4.190.0050.00316.62
7.4.160.0060.01216.79
7.4.150.0150.00317.40
7.4.140.0090.00917.86
7.4.130.0190.00816.75
7.4.120.0080.01016.88
7.4.110.0100.01016.96
7.4.100.0090.01516.83
7.4.90.0110.00616.63
7.4.80.0150.00619.39
7.4.70.0100.00716.73
7.4.60.0040.01216.96
7.4.50.0000.00916.83
7.4.40.0060.00622.77
7.4.30.0170.00716.92
7.4.00.0000.00915.05
7.3.330.0030.00313.45
7.3.320.0000.00513.42
7.3.310.0030.00316.62
7.3.300.0070.00016.54
7.3.290.0060.00916.46
7.3.280.0060.01116.59
7.3.270.0100.00717.40
7.3.260.0150.00718.24
7.3.250.0060.01116.63
7.3.240.0110.00616.83
7.3.230.0040.01316.61
7.3.210.0110.00616.51
7.3.200.0190.00019.39
7.3.190.0090.00816.85
7.3.180.0070.01016.75
7.3.170.0120.00416.75
7.3.160.0120.01216.74
7.3.120.0070.00714.80
7.2.330.0230.02617.04
7.2.320.0000.01817.05
7.2.310.0030.01516.86
7.2.300.0070.01117.10
7.2.290.0110.00717.00
7.2.00.0060.00919.40
7.1.100.0110.00418.46
7.1.70.0050.00217.25
7.1.60.0110.01419.17
7.1.50.0030.01317.23
7.1.00.0030.03322.33
7.0.200.0040.00417.13
7.0.140.0000.07321.99
7.0.80.0270.09020.06
7.0.70.0200.04020.17
7.0.60.0270.04020.00
7.0.50.0330.07020.42
7.0.40.0100.08020.08
7.0.30.0070.03720.13
7.0.20.0100.08320.12
7.0.10.0100.07020.14
7.0.00.0130.08020.07
5.6.280.0070.07020.93
5.6.230.0030.05020.62
5.6.220.0070.07020.51
5.6.210.0130.07320.68
5.6.200.0100.08020.96
5.6.190.0070.04020.95
5.6.180.0030.09021.06
5.6.170.0000.09321.09
5.6.160.0100.03721.05
5.6.150.0070.08721.04
5.6.140.0100.07721.13
5.6.130.0030.05321.05
5.6.120.0130.07320.99
5.6.110.0200.07021.03
5.6.100.0100.08021.05
5.6.90.0100.07721.04
5.6.80.0000.04320.42
5.6.70.0130.03720.56
5.6.60.0000.08320.52
5.6.50.0100.07320.45
5.6.40.0070.07720.34
5.6.30.0100.05020.44
5.6.20.0130.07020.45
5.6.10.0030.06320.38
5.6.00.0100.07720.50
5.5.370.0070.04020.52
5.5.360.0030.07020.55
5.5.350.0030.04320.41
5.5.340.0070.07020.86
5.5.330.0100.06720.82
5.5.320.0100.03020.82
5.5.310.0000.08320.86
5.5.300.0170.07320.85
5.5.290.0130.07320.94
5.5.280.0070.06720.88
5.5.270.0130.07020.87
5.5.260.0030.08720.93
5.5.250.0030.08720.63
5.5.240.0130.04020.30
5.5.230.0100.06320.16
5.5.220.0130.07020.22
5.5.210.0070.07020.27
5.5.200.0030.08020.17
5.5.190.0030.05020.29
5.5.180.0130.07320.10
5.5.160.0170.05320.13
5.5.150.0000.08720.23
5.5.140.0000.08020.18
5.5.130.0030.05020.25
5.5.120.0130.05020.29
5.5.110.0170.06320.29
5.5.100.0070.06720.00
5.5.90.0100.07720.08
5.5.80.0100.04020.03
5.5.70.0070.03720.08
5.5.60.0070.08019.98
5.5.50.0100.07319.95
5.5.40.0130.05720.02
5.5.30.0170.06020.05
5.5.20.0170.06320.05
5.5.10.0100.04720.08
5.5.00.0130.06720.08
5.4.450.0100.07319.42
5.4.440.0030.08019.35
5.4.430.0070.08019.22
5.4.420.0100.07319.35
5.4.410.0070.08019.36
5.4.400.0130.07319.23
5.4.390.0070.07319.14
5.4.380.0030.04319.14
5.4.370.0070.04719.03
5.4.360.0100.05019.05
5.4.350.0000.08319.19
5.4.340.0130.05719.09
5.4.320.0100.06719.16
5.4.310.0100.07018.87
5.4.300.0070.04019.18
5.4.290.0100.06719.05
5.4.280.0000.05019.15
5.4.270.0030.07019.02
5.4.260.0070.05019.03
5.4.250.0170.06719.17
5.4.240.0000.04319.08
5.4.230.0030.03719.02
5.4.220.0170.05319.02
5.4.210.0100.05019.12
5.4.200.0070.07019.20
5.4.190.0070.07719.13
5.4.180.0030.07718.87
5.4.170.0030.07019.04
5.4.160.0000.06318.86
5.4.150.0030.06319.11
5.4.140.0030.07716.47
5.4.130.0070.04716.25
5.4.120.0030.07716.55
5.4.110.0070.07316.33
5.4.100.0130.06316.54
5.4.90.0100.06016.44
5.4.80.0070.07716.55
5.4.70.0070.07716.55
5.4.60.0000.04016.40
5.4.50.0100.07016.45
5.4.40.0100.03716.39
5.4.30.0030.08016.46
5.4.20.0130.06316.49
5.4.10.0070.04316.33
5.4.00.0030.07315.91
5.3.290.0100.07714.75
5.3.280.0030.04014.75
5.3.270.0030.04714.77
5.3.260.0100.06714.73
5.3.250.0100.05714.55
5.3.240.0070.07014.56
5.3.230.0070.07314.57
5.3.220.0100.07014.66
5.3.210.0030.05314.54
5.3.200.0030.04014.62
5.3.190.0100.05314.62
5.3.180.0230.05714.56
5.3.170.0100.06014.58
5.3.160.0130.07014.51
5.3.150.0070.08014.55
5.3.140.0100.07314.64
5.3.130.0030.07314.49
5.3.120.0130.06014.68
5.3.110.0100.06314.71
5.3.100.0000.04714.16
5.3.90.0030.04714.10
5.3.80.0070.03714.03
5.3.70.0000.04014.13
5.3.60.0100.06714.08
5.3.50.0030.05014.02
5.3.40.0070.07314.09
5.3.30.0030.06713.86
5.3.20.0100.06313.64
5.3.10.0030.03713.61
5.3.00.0130.03313.58
5.2.170.0030.06311.05
5.2.160.0100.04011.10
5.2.150.0100.05711.07
5.2.140.0070.03311.18
5.2.130.0130.04311.26
5.2.120.0030.03711.05
5.2.110.0030.05011.18
5.2.100.0130.03311.14
5.2.90.0100.04011.02
5.2.80.0100.06011.20
5.2.70.0030.04711.25
5.2.60.0070.05311.21
5.2.50.0070.06010.96
5.2.40.0000.06010.91
5.2.30.0100.04710.91
5.2.20.0030.03311.10
5.2.10.0030.04010.74
5.2.00.0000.05710.77
5.1.60.0030.05010.09
5.1.50.0030.03010.05
5.1.40.0030.03310.07
5.1.30.0030.03710.46
5.1.20.0070.04710.29
5.1.10.0100.04710.20
5.1.00.0030.05310.14
5.0.50.0030.0238.57
5.0.40.0130.0138.54
5.0.30.0030.0438.34
5.0.20.0100.0378.31
5.0.10.0070.0308.29
5.0.00.0070.0338.18
4.4.90.0030.0177.56
4.4.80.0030.0337.56
4.4.70.0100.0307.56
4.4.60.0030.0237.56
4.4.50.0000.0307.56
4.4.40.0130.0307.56
4.4.30.0030.0377.56
4.4.20.0000.0207.56
4.4.10.0030.0277.56
4.4.00.0030.0437.56
4.3.110.0070.0277.56
4.3.100.0000.0377.56
4.3.90.0030.0337.56
4.3.80.0000.0537.56
4.3.70.0070.0177.56
4.3.60.0100.0277.56
4.3.50.0030.0277.56
4.3.40.0000.0507.56
4.3.30.0000.0237.56
4.3.20.0000.0237.56
4.3.10.0000.0277.56
4.3.00.0030.0207.56

preferences:
49.77 ms | 401 KiB | 5 Q