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, 1417392000); 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.0110.00418.68
8.3.50.0290.00421.27
8.3.40.0040.01119.26
8.3.30.0100.00320.47
8.3.20.0000.00720.46
8.3.10.0080.00022.21
8.3.00.0050.00322.50
8.2.180.0170.00316.88
8.2.170.0040.01122.96
8.2.160.0000.01420.47
8.2.150.0060.00324.18
8.2.140.0050.00324.66
8.2.130.0040.00426.16
8.2.120.0050.00319.13
8.2.110.0060.00321.25
8.2.100.0080.00418.28
8.2.90.0060.00319.41
8.2.80.0030.00618.18
8.2.70.0040.00418.13
8.2.60.0030.00618.18
8.2.50.0050.00318.13
8.2.40.0080.00018.41
8.2.30.0020.00519.63
8.2.20.0040.00418.17
8.2.10.0020.00518.06
8.2.00.0000.00918.16
8.1.280.0140.00025.92
8.1.270.0040.00423.99
8.1.260.0050.00326.35
8.1.250.0050.00328.09
8.1.240.0100.00022.41
8.1.230.0040.00817.73
8.1.220.0050.00318.77
8.1.210.0000.00819.09
8.1.200.0050.00517.72
8.1.190.0000.00817.77
8.1.180.0030.00618.10
8.1.170.0040.00418.82
8.1.160.0050.00319.13
8.1.150.0030.00618.91
8.1.140.0050.00317.74
8.1.130.0000.00718.06
8.1.120.0000.00717.83
8.1.110.0000.00717.81
8.1.100.0000.00817.82
8.1.90.0040.00417.83
8.1.80.0050.00217.87
8.1.70.0040.00417.80
8.1.60.0000.00817.92
8.1.50.0050.00317.77
8.1.40.0040.00417.71
8.1.30.0060.00317.84
8.1.20.0050.00317.88
8.1.10.0040.00417.93
8.1.00.0080.00017.78
8.0.300.0000.00820.14
8.0.290.0000.00717.30
8.0.280.0000.00818.61
8.0.270.0070.00017.41
8.0.260.0000.00717.18
8.0.250.0030.00317.39
8.0.240.0000.00817.36
8.0.230.0040.00317.45
8.0.220.0060.00317.25
8.0.210.0030.00317.27
8.0.200.0030.00317.40
8.0.190.0050.00317.39
8.0.180.0030.00517.34
8.0.170.0040.00417.28
8.0.160.0000.00717.30
8.0.150.0000.00717.31
8.0.140.0090.00017.31
8.0.130.0050.00013.65
8.0.120.0030.00617.19
8.0.110.0000.00717.35
8.0.100.0050.00317.39
8.0.90.0080.00017.28
8.0.80.0030.01317.32
8.0.70.0040.00417.28
8.0.60.0070.00017.34
8.0.50.0000.00717.20
8.0.30.0060.01317.49
8.0.20.0090.01117.46
8.0.10.0050.00317.29
8.0.00.0160.00817.07
7.4.330.0000.00517.01
7.4.320.0040.00416.90
7.4.300.0000.00616.94
7.4.290.0000.00716.87
7.4.280.0030.00316.71
7.4.270.0070.00016.68
7.4.260.0050.00013.58
7.4.250.0040.00416.88
7.4.240.0040.00416.92
7.4.230.0000.00816.73
7.4.220.0120.01216.95
7.4.210.0080.00816.91
7.4.200.0050.00216.79
7.4.190.0040.00417.09
7.4.160.0190.00617.00
7.4.150.0090.01217.40
7.4.140.0120.00917.86
7.4.130.0080.01116.99
7.4.120.0090.00916.79
7.4.110.0130.00316.82
7.4.100.0030.02116.86
7.4.90.0110.00717.11
7.4.80.0060.01119.39
7.4.70.0140.00616.91
7.4.60.0100.01016.75
7.4.50.0030.00617.02
7.4.40.0030.01122.77
7.4.30.0060.01216.87
7.4.00.0030.01015.04
7.3.330.0050.00013.58
7.3.320.0050.00013.64
7.3.310.0030.00316.68
7.3.300.0040.00416.51
7.3.290.0060.00716.61
7.3.280.0100.00716.63
7.3.270.0120.00617.40
7.3.260.0090.00918.24
7.3.250.0120.00416.75
7.3.240.0060.01016.63
7.3.230.0140.00316.72
7.3.210.0030.01416.73
7.3.200.0100.00719.39
7.3.190.0150.00816.73
7.3.180.0170.00016.70
7.3.170.0060.00916.87
7.3.160.0140.00616.69
7.3.120.0110.00415.27
7.3.110.0070.00715.25
7.3.100.0060.00314.94
7.3.90.0090.00615.19
7.3.80.0070.00815.33
7.3.70.0070.00715.17
7.3.60.0030.01315.18
7.3.50.0040.01414.84
7.3.40.0040.01415.16
7.3.30.0070.00314.96
7.3.20.0100.00317.04
7.3.10.0090.00916.75
7.3.00.0130.00316.79
7.2.330.0140.00616.91
7.2.320.0100.01316.77
7.2.310.0090.00917.04
7.2.300.0100.00716.97
7.2.290.0080.00816.89
7.2.240.0030.01015.57
7.2.230.0100.00315.59
7.2.220.0000.01315.41
7.2.210.0090.00615.27
7.2.200.0080.00415.18
7.2.190.0000.01415.23
7.2.180.0090.00915.45
7.2.170.0110.00415.43
7.2.160.0030.01415.45
7.2.150.0090.00617.10
7.2.140.0090.00317.26
7.2.130.0080.01116.92
7.2.120.0080.00616.86
7.2.110.0090.01217.10
7.2.100.0100.00717.10
7.2.90.0070.01516.77
7.2.80.0100.00617.25
7.2.70.0090.00816.96
7.2.60.0080.01117.15
7.2.50.0080.01016.94
7.2.40.0100.01217.00
7.2.30.0090.01417.11
7.2.20.0140.00717.23
7.2.10.0040.01217.00
7.2.00.0070.01017.22
7.1.330.0120.00616.11
7.1.320.0000.01816.07
7.1.310.0120.00615.78
7.1.300.0120.00016.11
7.1.290.0030.00616.10
7.1.280.0040.01116.04
7.1.270.0060.00615.86
7.1.260.0070.01016.09
7.1.250.0110.00415.74
7.1.200.0000.01516.09
7.1.70.0040.00417.23
7.1.60.0040.01819.17
7.1.50.0070.01517.35
7.1.00.0070.06322.45
7.0.200.0000.01117.11
7.0.140.0000.07322.01
7.0.90.0170.08719.95
7.0.80.0030.07019.99
7.0.70.0070.08319.95
7.0.60.0130.08019.91
7.0.50.0100.08320.48
7.0.40.0030.07320.13
7.0.30.0130.06320.18
7.0.20.0070.08720.10
7.0.10.0200.06720.10
7.0.00.0000.09020.11
5.6.280.0000.07721.14
5.6.240.0070.07720.69
5.6.230.0070.08020.65
5.6.220.0030.04320.73
5.6.210.0000.04720.60
5.6.200.0070.07721.04
5.6.190.0000.07020.90
5.6.180.0070.08021.13
5.6.170.0030.04021.12
5.6.160.0000.08321.13
5.6.150.0000.07720.97
5.6.140.0030.05021.19
5.6.130.0070.06321.12
5.6.120.0000.05021.12
5.6.110.0100.06021.09
5.6.100.0100.07321.02
5.6.90.0070.04720.96
5.6.80.0130.05320.51
5.6.70.0130.04020.45
5.6.60.0030.05020.41
5.6.50.0100.06720.57
5.6.40.0170.07320.46
5.6.30.0130.03720.46
5.6.20.0170.08320.31
5.6.10.0130.06320.32
5.6.00.0100.07320.31
5.5.380.0130.07020.37
5.5.370.0030.05020.44
5.5.360.0000.07720.43
5.5.350.0030.05320.54
5.5.340.0100.08020.85
5.5.330.0070.04320.76
5.5.320.0070.03720.95
5.5.310.0030.08020.62
5.5.300.0070.07320.82
5.5.290.0130.08020.95
5.5.280.0030.08720.87
5.5.270.0070.08720.89
5.5.260.0030.07320.65
5.5.250.0070.06320.66
5.5.240.0100.06720.19
5.5.230.0030.08020.04
5.5.220.0070.04320.19
5.5.210.0000.08020.26
5.5.200.0130.07320.30
5.5.190.0130.07320.10
5.5.180.0000.07020.14
5.5.160.0070.04720.25
5.5.150.0200.06720.01
5.5.140.0030.07320.14
5.5.130.0030.04720.25
5.5.120.0130.07320.10
5.5.110.0070.04320.19
5.5.100.0070.04720.15
5.5.90.0070.04320.05
5.5.80.0130.06720.11
5.5.70.0130.06720.05
5.5.60.0070.07719.98
5.5.50.0100.04320.18
5.5.40.0070.08020.14
5.5.30.0030.05020.07
5.5.20.0170.06720.05
5.5.10.0030.04320.00
5.5.00.0170.05320.00
5.4.450.0030.08319.27
5.4.440.0030.08019.22
5.4.430.0030.06319.55
5.4.420.0000.04719.19
5.4.410.0030.07719.43
5.4.400.0100.03719.21
5.4.390.0130.07319.16
5.4.380.0070.07019.02
5.4.370.0000.04719.23
5.4.360.0070.08719.23
5.4.350.0070.04319.14
5.4.340.0130.07719.14
5.4.320.0100.07318.88
5.4.310.0100.05719.05
5.4.300.0070.07319.16
5.4.290.0130.06319.16
5.4.280.0100.07719.20
5.4.270.0070.04319.11
5.4.260.0070.07319.20
5.4.250.0130.06719.08
5.4.240.0030.07019.22
5.4.230.0130.07719.23
5.4.220.0070.07319.09
5.4.210.0070.07018.94
5.4.200.0170.06719.09
5.4.190.0070.04319.20
5.4.180.0070.04719.11
5.4.170.0100.07319.15
5.4.160.0200.06719.07
5.4.150.0170.06718.89
5.4.140.0130.06016.50
5.4.130.0130.05016.39
5.4.120.0030.07716.30
5.4.110.0100.07016.52
5.4.100.0030.04016.33
5.4.90.0000.07716.38
5.4.80.0130.06316.40
5.4.70.0070.04016.43
5.4.60.0100.06716.40
5.4.50.0100.05016.42
5.4.40.0000.04316.36
5.4.30.0030.07716.42
5.4.20.0070.07716.31
5.4.10.0030.07716.39
5.4.00.0070.06015.80
5.3.290.0000.07314.70
5.3.280.0130.04014.68
5.3.270.0030.04314.59
5.3.260.0100.07014.65
5.3.250.0030.07014.66
5.3.240.0100.07014.70
5.3.230.0130.07714.59
5.3.220.0030.04314.52
5.3.210.0030.07314.66
5.3.200.0100.04314.66
5.3.190.0030.09014.52
5.3.180.0100.06714.59
5.3.170.0100.07314.60
5.3.160.0100.03014.55
5.3.150.0000.07714.55
5.3.140.0030.04714.67
5.3.130.0100.07714.50
5.3.120.0070.07314.54
5.3.110.0070.08014.66
5.3.100.0000.08314.13
5.3.90.0100.07014.05
5.3.80.0100.05014.16
5.3.70.0000.07714.17
5.3.60.0070.08014.08
5.3.50.0070.07313.96
5.3.40.0070.06313.87
5.3.30.0030.04013.82
5.3.20.0100.06713.60
5.3.10.0000.05313.70
5.3.00.0030.03713.71
5.2.170.0130.05711.30
5.2.160.0070.06311.27
5.2.150.0030.06311.17
5.2.140.0030.06311.19
5.2.130.0030.06711.25
5.2.120.0070.05311.05
5.2.110.0070.02711.22
5.2.100.0030.02711.26
5.2.90.0030.04711.21
5.2.80.0070.02711.17
5.2.70.0070.03011.18
5.2.60.0000.03011.06
5.2.50.0070.02710.97
5.2.40.0030.04311.09
5.2.30.0030.03710.98
5.2.20.0000.03010.96
5.2.10.0000.03010.81
5.2.00.0030.02710.88
5.1.60.0030.02310.50
5.1.50.0070.01710.50
5.1.40.0000.02710.50
5.1.30.0030.04710.50
5.1.20.0070.03710.50
5.1.10.0000.03310.50
5.1.00.0070.05010.50
5.0.50.0070.03710.50
5.0.40.0030.03710.50
5.0.30.0000.03310.50
5.0.20.0030.04010.50
5.0.10.0000.04310.50
5.0.00.0030.06710.50
4.4.90.0070.01010.50
4.4.80.0030.01310.50
4.4.70.0030.02710.50
4.4.60.0030.01310.50
4.4.50.0030.01310.50
4.4.40.0000.02710.50
4.4.30.0000.02710.50
4.4.20.0030.01310.50
4.4.10.0000.03310.50
4.4.00.0000.05010.50
4.3.110.0000.02310.50
4.3.100.0000.03010.50
4.3.90.0030.02010.50
4.3.80.0030.02710.50
4.3.70.0030.01310.50
4.3.60.0030.01310.50
4.3.50.0030.02310.50
4.3.40.0030.02310.50
4.3.30.0000.01710.50
4.3.20.0000.01710.50
4.3.10.0000.01710.50
4.3.00.0000.01710.50

preferences:
47.12 ms | 400 KiB | 5 Q