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, 1480554061); 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.0070.01118.80
8.3.50.0260.00621.27
8.3.40.0040.01119.31
8.3.30.0100.00320.47
8.3.20.0040.00420.34
8.3.10.0050.00322.17
8.3.00.0040.00422.46
8.2.180.0140.00716.88
8.2.170.0120.00322.96
8.2.160.0100.00322.26
8.2.150.0090.00024.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00420.91
8.2.110.0060.00321.06
8.2.100.0090.00318.16
8.2.90.0000.00819.51
8.2.80.0000.00818.14
8.2.70.0030.00917.88
8.2.60.0000.00818.28
8.2.50.0000.00818.10
8.2.40.0050.00318.28
8.2.30.0070.00019.52
8.2.20.0050.00318.23
8.2.10.0030.00618.17
8.2.00.0040.00418.24
8.1.280.0090.00925.92
8.1.270.0050.00323.99
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0000.01024.11
8.1.230.0090.00317.89
8.1.220.0070.00317.79
8.1.210.0000.00818.77
8.1.200.0070.00317.85
8.1.190.0030.00517.73
8.1.180.0000.00818.10
8.1.170.0050.00318.88
8.1.160.0000.00819.14
8.1.150.0040.00418.92
8.1.140.0040.00417.81
8.1.130.0030.00318.05
8.1.120.0000.00717.86
8.1.110.0050.00217.65
8.1.100.0000.00717.88
8.1.90.0070.00017.67
8.1.80.0000.00817.79
8.1.70.0000.00717.84
8.1.60.0000.00917.94
8.1.50.0030.00517.78
8.1.40.0030.00517.79
8.1.30.0040.00417.95
8.1.20.0000.00917.90
8.1.10.0040.00417.84
8.1.00.0040.00417.95
8.0.300.0000.00919.15
8.0.290.0060.00317.25
8.0.280.0030.00518.70
8.0.270.0030.00317.50
8.0.260.0000.00618.58
8.0.250.0050.00217.39
8.0.240.0030.00617.37
8.0.230.0030.00517.27
8.0.220.0030.00317.38
8.0.210.0070.00017.35
8.0.200.0060.00017.44
8.0.190.0040.00417.34
8.0.180.0000.00717.25
8.0.170.0050.00317.34
8.0.160.0070.00017.38
8.0.150.0050.00217.29
8.0.140.0050.00217.18
8.0.130.0000.00613.61
8.0.120.0040.00417.18
8.0.110.0050.00217.39
8.0.100.0000.00717.13
8.0.90.0020.00517.43
8.0.80.0100.00717.33
8.0.70.0040.00417.40
8.0.60.0050.00317.30
8.0.50.0040.00417.39
8.0.30.0090.01317.53
8.0.20.0130.00817.51
8.0.10.0070.00017.35
8.0.00.0120.00617.13
7.4.330.0030.00316.83
7.4.320.0070.00016.74
7.4.300.0030.00316.84
7.4.290.0030.00316.86
7.4.280.0030.00316.82
7.4.270.0000.00716.83
7.4.260.0000.00513.54
7.4.250.0000.00816.79
7.4.240.0020.00516.94
7.4.230.0000.00716.71
7.4.220.0150.00316.94
7.4.210.0060.01016.85
7.4.200.0070.00016.72
7.4.190.0000.00816.83
7.4.160.0120.00616.77
7.4.150.0060.01217.40
7.4.140.0060.01117.86
7.4.130.0130.00616.94
7.4.120.0120.00516.90
7.4.110.0120.00416.84
7.4.100.0120.00616.97
7.4.90.0100.00716.80
7.4.80.0160.00719.39
7.4.70.0060.01216.98
7.4.60.0120.00616.77
7.4.50.0030.00316.77
7.4.40.0030.01322.77
7.4.30.0060.01516.64
7.4.00.0080.00615.24
7.3.330.0060.00013.63
7.3.320.0030.00313.49
7.3.310.0070.00016.68
7.3.300.0000.00716.62
7.3.290.0090.00916.63
7.3.280.0050.01016.64
7.3.270.0210.00317.40
7.3.260.0060.01218.24
7.3.250.0070.00916.86
7.3.240.0170.00016.53
7.3.230.0100.01116.93
7.3.210.0100.00616.64
7.3.200.0080.00819.39
7.3.190.0040.01416.71
7.3.180.0070.01016.79
7.3.170.0090.00616.85
7.3.160.0100.00716.84
7.3.120.0080.00915.05
7.3.110.0100.00615.12
7.3.100.0000.01214.90
7.3.90.0050.00815.13
7.3.80.0040.01115.11
7.3.70.0070.00715.04
7.3.60.0030.00815.04
7.3.50.0030.00815.06
7.3.40.0030.01015.16
7.3.30.0100.00315.16
7.3.20.0050.01016.79
7.3.10.0090.00816.61
7.3.00.0120.00716.80
7.2.330.0080.01217.13
7.2.320.0150.00617.13
7.2.310.0110.01416.95
7.2.300.0080.00816.80
7.2.290.0100.00716.81
7.2.250.0060.01115.57
7.2.240.0030.01515.34
7.2.230.0080.00815.23
7.2.220.0050.00615.40
7.2.210.0080.00415.35
7.2.200.0040.00915.32
7.2.190.0110.00315.30
7.2.180.0020.01215.35
7.2.170.0100.00515.05
7.2.130.0140.00916.47
7.2.120.0310.00917.07
7.2.110.0490.00316.99
7.2.100.0070.01316.91
7.2.90.0740.00917.15
7.2.80.0390.00916.48
7.2.70.0420.01516.98
7.2.60.0650.00416.81
7.2.50.0620.00917.18
7.2.40.0390.01116.68
7.2.30.0480.00016.42
7.2.20.0200.01116.39
7.2.10.0540.00616.53
7.2.00.0170.00818.15
7.1.330.0050.01016.08
7.1.320.0010.00916.08
7.1.310.0070.00515.99
7.1.300.0030.00615.80
7.1.290.0110.00516.00
7.1.280.0060.00815.98
7.1.270.0080.00716.09
7.1.260.0020.01116.04
7.1.250.0150.00715.87
7.1.200.0000.01016.02
7.1.100.0040.00818.17
7.1.70.0000.01017.10
7.1.60.0160.01019.17
7.1.50.0110.01517.29
7.1.00.0030.04022.37
7.0.200.0030.00316.97
7.0.140.0030.07321.97
7.0.80.0070.04719.92
7.0.70.0130.03320.06
7.0.60.0300.07719.98
7.0.50.0270.07720.20
7.0.40.0100.07719.91
7.0.30.0070.08020.06
7.0.20.0030.06720.14
7.0.10.0130.07320.17
7.0.00.0130.07320.04
5.6.280.0000.07721.13
5.6.230.0000.04720.55
5.6.220.0000.06720.57
5.6.210.0100.07320.79
5.6.200.0070.07721.07
5.6.190.0130.08721.19
5.6.180.0030.07721.08
5.6.170.0000.09321.13
5.6.160.0100.05321.04
5.6.150.0000.05320.97
5.6.140.0130.07721.04
5.6.130.0000.06721.07
5.6.120.0070.03321.09
5.6.110.0000.06021.03
5.6.100.0030.07721.05
5.6.90.0130.08021.07
5.6.80.0030.08020.34
5.6.70.0070.07720.51
5.6.60.0170.06720.41
5.6.50.0170.09320.42
5.6.40.0070.07320.32
5.6.30.0000.09020.42
5.6.20.0170.08020.30
5.6.10.0170.06720.45
5.6.00.0100.05320.40
5.5.370.0000.04320.59
5.5.360.0130.07320.55
5.5.350.0130.05720.33
5.5.340.0100.08020.85
5.5.330.0130.08020.88
5.5.320.0070.08020.82
5.5.310.0170.05320.79
5.5.300.0030.08720.86
5.5.290.0070.09320.77
5.5.280.0030.04720.85
5.5.270.0070.06320.65
5.5.260.0170.07320.94
5.5.250.0100.07320.55
5.5.240.0030.08320.31
5.5.230.0200.04720.27
5.5.220.0130.07320.16
5.5.210.0230.07020.18
5.5.200.0030.07020.13
5.5.190.0070.08320.27
5.5.180.0070.07320.11
5.5.160.0000.08720.20
5.5.150.0130.05020.13
5.5.140.0070.07020.20
5.5.130.0000.07720.17
5.5.120.0000.07720.14
5.5.110.0000.09020.25
5.5.100.0100.05319.98
5.5.90.0130.06720.09
5.5.80.0170.07320.09
5.5.70.0100.03720.19
5.5.60.0030.08720.10
5.5.50.0000.06320.08
5.5.40.0130.07019.96
5.5.30.0130.05320.05
5.5.20.0000.05020.12
5.5.10.0070.03719.98
5.5.00.0100.04720.07
5.4.450.0130.08019.36
5.4.440.0030.04719.27
5.4.430.0100.05019.45
5.4.420.0070.06719.35
5.4.410.0030.07319.24
5.4.400.0070.07718.85
5.4.390.0130.04719.09
5.4.380.0200.06318.91
5.4.370.0130.07019.14
5.4.360.0100.04018.90
5.4.350.0070.06719.12
5.4.340.0100.07319.16
5.4.320.0030.06019.23
5.4.310.0170.07019.03
5.4.300.0030.07719.23
5.4.290.0070.04719.13
5.4.280.0100.07319.04
5.4.270.0170.06718.89
5.4.260.0100.07019.14
5.4.250.0100.08019.18
5.4.240.0000.05319.02
5.4.230.0100.04318.84
5.4.220.0030.04318.94
5.4.210.0070.07718.94
5.4.200.0070.07019.04
5.4.190.0000.04719.22
5.4.180.0030.03718.94
5.4.170.0070.05319.11
5.4.160.0070.04318.86
5.4.150.0100.04019.10
5.4.140.0100.03716.39
5.4.130.0070.04316.46
5.4.120.0000.05716.48
5.4.110.0000.03316.50
5.4.100.0130.04016.45
5.4.90.0070.03316.41
5.4.80.0000.05716.47
5.4.70.0000.03716.52
5.4.60.0030.03716.48
5.4.50.0030.06316.48
5.4.40.0070.03316.46
5.4.30.0070.03316.47
5.4.20.0030.03316.45
5.4.10.0070.03316.41
5.4.00.0070.05315.86
5.3.290.0070.08714.77
5.3.280.0100.04014.57
5.3.270.0070.04014.59
5.3.260.0000.04714.69
5.3.250.0000.04314.68
5.3.240.0070.03714.69
5.3.230.0070.07314.59
5.3.220.0070.07014.59
5.3.210.0030.05014.73
5.3.200.0070.04014.73
5.3.190.0030.03714.70
5.3.180.0000.05314.74
5.3.170.0070.06014.64
5.3.160.0000.04014.61
5.3.150.0030.03714.67
5.3.140.0000.05014.55
5.3.130.0070.03314.59
5.3.120.0030.03714.56
5.3.110.0070.04014.55
5.3.100.0030.08314.12
5.3.90.0070.04713.97
5.3.80.0100.04313.95
5.3.70.0100.04014.13
5.3.60.0070.07013.92
5.3.50.0000.05713.89
5.3.40.0030.05713.98
5.3.30.0100.05313.99
5.3.20.0070.03713.64
5.3.10.0070.03313.70
5.3.00.0030.06313.78
5.2.170.0000.04311.28
5.2.160.0030.02711.08
5.2.150.0030.04311.20
5.2.140.0070.03311.30
5.2.130.0000.03711.01
5.2.120.0030.02711.05
5.2.110.0000.04011.14
5.2.100.0000.06011.02
5.2.90.0070.04311.11
5.2.80.0070.03711.18
5.2.70.0070.06011.18
5.2.60.0230.03711.16
5.2.50.0000.04711.15
5.2.40.0030.04011.08
5.2.30.0000.03710.90
5.2.20.0130.05310.84
5.2.10.0070.04310.79
5.2.00.0100.05310.80
5.1.60.0000.04310.09
5.1.50.0030.03710.02
5.1.40.0030.03310.00
5.1.30.0030.05310.35
5.1.20.0070.03710.51
5.1.10.0000.04010.19
5.1.00.0000.06010.21
5.0.50.0030.0238.43
5.0.40.0070.0308.45
5.0.30.0070.0578.25
5.0.20.0070.0408.31
5.0.10.0070.0408.32
5.0.00.0030.0578.31
4.4.90.0000.0277.42
4.4.80.0000.0177.42
4.4.70.0030.0337.42
4.4.60.0070.0337.42
4.4.50.0000.0377.42
4.4.40.0000.0537.42
4.4.30.0030.0407.42
4.4.20.0000.0177.42
4.4.10.0000.0207.42
4.4.00.0030.0237.42
4.3.110.0000.0337.42
4.3.100.0100.0207.42
4.3.90.0070.0307.42
4.3.80.0030.0537.42
4.3.70.0000.0337.42
4.3.60.0100.0277.42
4.3.50.0070.0307.42
4.3.40.0030.0577.42
4.3.30.0000.0307.42
4.3.20.0030.0337.42
4.3.10.0030.0337.42
4.3.00.0030.0377.42

preferences:
46.19 ms | 401 KiB | 5 Q