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; $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.0170.00318.68
8.3.50.0100.01321.33
8.3.40.0030.01219.09
8.3.30.0100.00320.21
8.3.20.0070.00020.13
8.3.10.0000.00822.08
8.3.00.0040.00422.32
8.2.180.0180.00016.75
8.2.170.0000.01522.96
8.2.160.0070.00722.30
8.2.150.0060.00324.18
8.2.140.0000.00824.66
8.2.130.0050.00226.16
8.2.120.0070.00721.05
8.2.110.0030.00722.24
8.2.100.0130.00018.09
8.2.90.0000.00819.38
8.2.80.0050.00319.25
8.2.70.0080.00017.98
8.2.60.0000.00818.05
8.2.50.0040.00418.07
8.2.40.0050.00518.46
8.2.30.0050.00319.49
8.2.20.0000.00718.15
8.2.10.0070.00018.18
8.2.00.0030.00618.02
8.1.280.0090.00625.92
8.1.270.0030.00623.99
8.1.260.0030.00526.35
8.1.250.0040.00428.09
8.1.240.0000.00923.83
8.1.230.0040.00718.02
8.1.220.0030.00617.74
8.1.210.0030.00618.77
8.1.200.0040.00417.72
8.1.190.0090.00017.88
8.1.180.0060.00318.10
8.1.170.0050.00318.88
8.1.160.0030.00518.94
8.1.150.0080.00018.93
8.1.140.0050.00317.68
8.1.130.0000.00719.55
8.1.120.0040.00417.75
8.1.110.0040.00417.74
8.1.100.0040.00417.64
8.1.90.0000.00817.80
8.1.80.0000.00817.67
8.1.70.0030.00317.75
8.1.60.0050.00317.82
8.1.50.0040.00417.72
8.1.40.0050.00317.77
8.1.30.0040.00417.75
8.1.20.0050.00517.85
8.1.10.0070.00017.70
8.1.00.0000.00817.70
8.0.300.0090.00018.77
8.0.290.0050.00317.28
8.0.280.0040.00418.50
8.0.270.0080.00017.45
8.0.260.0060.00318.98
8.0.250.0070.00017.34
8.0.240.0000.00817.24
8.0.230.0000.00717.22
8.0.220.0000.00817.32
8.0.210.0030.00317.16
8.0.200.0000.00617.19
8.0.190.0000.00817.21
8.0.180.0080.00017.33
8.0.170.0080.00017.27
8.0.160.0040.00417.20
8.0.150.0000.00717.21
8.0.140.0050.00217.23
8.0.130.0030.00313.55
8.0.120.0080.00017.24
8.0.110.0000.00717.22
8.0.100.0050.00217.35
8.0.90.0000.00717.34
8.0.80.0150.00017.33
8.0.70.0040.00417.31
8.0.60.0040.00417.12
8.0.50.0000.00817.29
8.0.30.0100.01017.47
8.0.20.0120.00717.49
8.0.10.0040.00417.29
8.0.00.0080.01217.09
7.4.330.0020.00216.90
7.4.320.0000.00616.76
7.4.300.0060.00016.80
7.4.290.0040.00416.74
7.4.280.0000.00816.84
7.4.270.0000.00716.66
7.4.260.0080.00013.52
7.4.250.0000.00816.83
7.4.240.0000.00716.73
7.4.230.0030.00316.74
7.4.220.0090.01216.94
7.4.210.0070.00916.86
7.4.200.0030.00316.69
7.4.190.0030.00516.76
7.4.160.0040.01516.80
7.4.150.0110.00717.40
7.4.140.0120.00617.86
7.4.130.0120.00716.74
7.4.120.0120.00516.83
7.4.110.0060.01216.85
7.4.100.0040.01716.91
7.4.90.0190.00016.84
7.4.80.0110.00819.39
7.4.70.0100.00616.73
7.4.60.0030.01316.78
7.4.50.0000.00816.64
7.4.40.0180.00022.77
7.4.30.0090.01216.78
7.4.00.0000.01615.05
7.3.330.0030.00313.55
7.3.320.0050.00013.45
7.3.310.0070.00016.57
7.3.300.0000.00716.46
7.3.290.0070.00716.66
7.3.280.0140.00516.58
7.3.270.0140.00317.40
7.3.260.0100.01918.24
7.3.250.0050.01216.72
7.3.240.0070.01016.71
7.3.230.0110.01116.65
7.3.210.0100.00616.57
7.3.200.0170.00719.39
7.3.190.0030.01516.66
7.3.180.0100.00616.63
7.3.170.0110.00616.76
7.3.160.0070.01016.80
7.3.120.0030.01215.10
7.3.110.0090.00915.19
7.3.100.0090.00915.23
7.3.90.0110.00715.00
7.3.80.0030.01215.08
7.3.70.0080.00414.90
7.3.60.0070.00414.93
7.3.50.0030.01415.11
7.3.40.0060.00615.25
7.3.30.0070.00715.30
7.3.20.0150.00016.96
7.3.10.0070.00716.89
7.3.00.0090.00616.65
7.2.330.0090.00917.05
7.2.320.0070.01017.06
7.2.310.0090.00916.88
7.2.300.0200.00316.77
7.2.290.0070.01317.12
7.2.250.0040.01415.14
7.2.240.0070.01415.01
7.2.230.0070.00315.41
7.2.220.0000.01215.34
7.2.210.0070.01115.60
7.2.200.0030.01315.46
7.2.190.0090.00315.15
7.2.180.0090.00015.15
7.2.170.0070.01115.02
7.2.00.0090.00619.29
7.1.330.0000.01215.86
7.1.320.0030.01015.71
7.1.310.0090.00315.97
7.1.300.0040.00415.92
7.1.290.0080.00315.86
7.1.280.0090.00615.81
7.1.270.0130.00315.66
7.1.260.0040.00815.71
7.1.100.0000.01118.30
7.1.70.0000.01117.39
7.1.60.0030.02119.17
7.1.50.0070.01717.25
7.1.00.0030.03322.54
7.0.200.0050.00316.71
7.0.140.0030.09022.02
7.0.100.0030.07719.96
7.0.90.0070.07319.97
7.0.80.0170.06020.03
7.0.70.0100.06719.93
7.0.60.0100.08019.99
7.0.50.0070.04720.38
7.0.40.0100.04019.95
7.0.30.0030.07020.11
7.0.20.0130.08320.11
7.0.10.0100.05020.00
7.0.00.0130.08320.13
5.6.280.0000.07721.11
5.6.250.0170.04020.61
5.6.240.0130.06020.54
5.6.230.0030.08720.70
5.6.220.0100.06320.60
5.6.210.0130.07020.59
5.6.200.0070.07720.98
5.6.190.0100.08021.19
5.6.180.0130.07720.96
5.6.170.0130.04021.04
5.6.160.0030.06021.13
5.6.150.0000.08721.08
5.6.140.0100.04721.13
5.6.130.0170.07321.02
5.6.120.0130.08321.11
5.6.110.0130.07721.03
5.6.100.0130.08021.03
5.6.90.0070.08721.04
5.6.80.0030.07720.41
5.6.70.0000.05020.51
5.6.60.0070.08320.47
5.6.50.0130.06720.46
5.6.40.0100.07320.48
5.6.30.0130.04720.49
5.6.20.0070.07720.41
5.6.10.0070.08320.39
5.6.00.0100.08020.41
5.5.380.0030.08020.37
5.5.370.0170.07020.43
5.5.360.0130.07320.57
5.5.350.0070.08720.49
5.5.340.0030.07320.85
5.5.330.0030.04320.85
5.5.320.0100.08020.92
5.5.310.0170.06720.78
5.5.300.0200.07720.90
5.5.290.0100.08320.75
5.5.280.0030.09020.88
5.5.270.0030.08720.88
5.5.260.0070.08720.84
5.5.250.0130.08020.75
5.5.240.0070.08320.14
5.5.230.0070.06320.27
5.5.220.0130.07320.28
5.5.210.0100.07320.17
5.5.200.0100.07720.15
5.5.190.0000.07719.98
5.5.180.0170.06320.02
5.5.160.0100.04320.13
5.5.150.0070.07320.23
5.5.140.0030.08020.20
5.5.130.0070.04320.19
5.5.120.0030.06020.28
5.5.110.0100.05020.14
5.5.100.0200.06020.15
5.5.90.0130.07320.03
5.5.80.0100.07720.19
5.5.70.0070.04720.08
5.5.60.0100.04019.98
5.5.50.0100.06020.07
5.5.40.0100.07320.13
5.5.30.0070.05720.15
5.5.20.0100.04720.17
5.5.10.0000.08719.98
5.5.00.0070.10020.05
5.4.450.0070.06319.54
5.4.440.0100.07719.45
5.4.430.0230.06719.41
5.4.420.0070.04719.17
5.4.410.0100.07319.14
5.4.400.0130.07019.03
5.4.390.0070.08019.16
5.4.380.0030.07719.16
5.4.370.0070.07319.05
5.4.360.0100.07319.09
5.4.350.0130.05719.12
5.4.340.0030.08019.18
5.4.320.0070.08319.16
5.4.310.0070.04719.23
5.4.300.0000.08719.02
5.4.290.0030.08018.90
5.4.280.0070.06719.03
5.4.270.0170.06319.18
5.4.260.0000.05318.95
5.4.250.0030.05019.03
5.4.240.0100.07019.15
5.4.230.0100.07719.17
5.4.220.0130.07719.12
5.4.210.0000.08319.19
5.4.200.0100.04319.11
5.4.190.0130.07018.94
5.4.180.0070.06019.08
5.4.170.0130.07019.17
5.4.160.0070.08319.10
5.4.150.0030.07718.83
5.4.140.0070.04316.50
5.4.130.0000.04716.51
5.4.120.0130.05716.44
5.4.110.0130.06016.45
5.4.100.0130.06716.38
5.4.90.0030.05316.52
5.4.80.0130.05316.43
5.4.70.0070.07016.46
5.4.60.0100.07016.40
5.4.50.0030.07716.36
5.4.40.0030.07716.36
5.4.30.0000.07316.36
5.4.20.0070.06016.38
5.4.10.0030.06716.45
5.4.00.0030.04315.69
5.3.290.0030.08014.82
5.3.280.0000.04714.57
5.3.270.0130.07314.60
5.3.260.0070.05314.69
5.3.250.0070.04714.56
5.3.240.0100.07014.69
5.3.230.0130.03714.68
5.3.220.0070.03714.58
5.3.210.0100.07314.68
5.3.200.0030.04314.58
5.3.190.0070.05314.55
5.3.180.0070.07714.64
5.3.170.0200.06314.70
5.3.160.0130.07014.59
5.3.150.0070.04314.51
5.3.140.0130.06714.63
5.3.130.0030.04714.58
5.3.120.0000.07714.69
5.3.110.0030.05314.58
5.3.100.0100.07014.20
5.3.90.0070.06314.06
5.3.80.0100.06314.04
5.3.70.0030.04314.09
5.3.60.0100.04713.95
5.3.50.0000.08013.96
5.3.40.0070.05314.02
5.3.30.0100.07313.96
5.3.20.0030.04313.82
5.3.10.0070.04013.73
5.3.00.0030.03713.59
5.2.170.0100.05011.29
5.2.160.0000.06711.29
5.2.150.0100.03311.28
5.2.140.0070.04011.28
5.2.130.0070.02711.28
5.2.120.0000.03311.28
5.2.110.0030.03011.28
5.2.100.0000.03011.28
5.2.90.0000.03011.28
5.2.80.0000.03011.28
5.2.70.0030.03311.28
5.2.60.0000.03311.28
5.2.50.0070.02711.28
5.2.40.0000.03011.28
5.2.30.0030.02711.28
5.2.20.0100.01711.28
5.2.10.0070.02311.28
5.2.00.0030.02311.28
5.1.60.0030.02311.28
5.1.50.0100.02711.28
5.1.40.0030.02311.28
5.1.30.0030.02311.28
5.1.20.0070.02311.28
5.1.10.0030.02311.28
5.1.00.0030.02311.28
5.0.50.0000.02011.28
5.0.40.0000.02011.28
5.0.30.0030.03311.28
5.0.20.0000.02011.28
5.0.10.0000.02011.28
5.0.00.0070.02711.28
4.4.90.0000.01311.28
4.4.80.0000.01711.28
4.4.70.0030.01011.28
4.4.60.0000.02011.28
4.4.50.0000.01711.28
4.4.40.0030.03011.28
4.4.30.0030.01311.28
4.4.20.0000.01711.28
4.4.10.0030.02011.28
4.4.00.0030.02311.28
4.3.110.0030.01711.28
4.3.100.0000.01711.28
4.3.90.0000.01711.28
4.3.80.0000.02311.28
4.3.70.0000.01311.28
4.3.60.0030.01311.28
4.3.50.0000.01711.28
4.3.40.0000.02311.28
4.3.30.0030.01311.28
4.3.20.0000.01711.28
4.3.10.0030.01311.28
4.3.00.0000.01711.28

preferences:
38.14 ms | 401 KiB | 5 Q