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, 12417395661); 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.01018.68
8.3.50.0100.00821.21
8.3.40.0110.00419.09
8.3.30.0040.01420.33
8.3.20.0000.00720.47
8.3.10.0050.00322.23
8.3.00.0000.00822.40
8.2.180.0090.00917.13
8.2.170.0100.00722.96
8.2.160.0000.01422.25
8.2.150.0080.00024.18
8.2.140.0050.00324.66
8.2.130.0070.00026.16
8.2.120.0080.00021.04
8.2.110.0070.00322.33
8.2.100.0040.00718.09
8.2.90.0000.00819.47
8.2.80.0070.00019.54
8.2.70.0040.00417.88
8.2.60.0050.00318.25
8.2.50.0080.00018.07
8.2.40.0040.00418.46
8.2.30.0030.00519.68
8.2.20.0050.00218.08
8.2.10.0000.00818.24
8.2.00.0040.00418.06
8.1.280.0120.00325.92
8.1.270.0080.00023.99
8.1.260.0050.00326.35
8.1.250.0040.00428.09
8.1.240.0030.00619.54
8.1.230.0080.00419.73
8.1.220.0030.00517.74
8.1.210.0000.00818.77
8.1.200.0030.00617.73
8.1.190.0000.00817.77
8.1.180.0040.00418.10
8.1.170.0000.00818.86
8.1.160.0000.00819.14
8.1.150.0080.00019.00
8.1.140.0040.00417.74
8.1.130.0030.00318.01
8.1.120.0000.00717.84
8.1.110.0040.00417.70
8.1.100.0020.00517.79
8.1.90.0050.00317.84
8.1.80.0040.00417.84
8.1.70.0030.00317.68
8.1.60.0080.00017.90
8.1.50.0020.00517.78
8.1.40.0060.00317.85
8.1.30.0000.00717.93
8.1.20.0000.00817.96
8.1.10.0030.00617.91
8.1.00.0040.00417.89
8.0.300.0040.00418.77
8.0.290.0060.00317.27
8.0.280.0070.00018.70
8.0.270.0030.00317.52
8.0.260.0050.00217.13
8.0.250.0000.00717.31
8.0.240.0000.00817.30
8.0.230.0040.00417.38
8.0.220.0030.00317.20
8.0.210.0040.00417.34
8.0.200.0000.00717.27
8.0.190.0030.00617.39
8.0.180.0000.00717.36
8.0.170.0040.00417.28
8.0.160.0000.00717.36
8.0.150.0000.00817.17
8.0.140.0070.00017.19
8.0.130.0030.00313.69
8.0.120.0030.00517.27
8.0.110.0000.00717.20
8.0.100.0040.00417.39
8.0.90.0040.00417.13
8.0.80.0100.01017.40
8.0.70.0000.00717.21
8.0.60.0000.00717.40
8.0.50.0040.00417.33
8.0.30.0130.00717.40
8.0.20.0110.00917.47
8.0.10.0040.00417.27
8.0.00.0100.01017.24
7.4.330.0020.00216.93
7.4.320.0030.00316.84
7.4.300.0000.00616.89
7.4.290.0030.00316.74
7.4.280.0050.00316.82
7.4.270.0040.00416.93
7.4.260.0030.00313.47
7.4.250.0040.00416.86
7.4.240.0030.00416.88
7.4.230.0000.00716.89
7.4.220.0110.00816.94
7.4.210.0090.00716.88
7.4.200.0080.00016.87
7.4.190.0030.00317.07
7.4.160.0150.00616.80
7.4.150.0180.00017.40
7.4.140.0080.01217.86
7.4.130.0080.01316.89
7.4.120.0150.00216.83
7.4.110.0060.01016.64
7.4.100.0040.01316.98
7.4.90.0120.00416.88
7.4.80.0120.00819.39
7.4.70.0110.00616.89
7.4.60.0050.01116.69
7.4.50.0080.00016.76
7.4.40.0030.00922.77
7.4.30.0030.01916.91
7.4.00.0040.01415.36
7.3.330.0050.00013.51
7.3.320.0050.00013.65
7.3.310.0040.00416.75
7.3.300.0000.00716.52
7.3.290.0070.00716.66
7.3.280.0060.01016.64
7.3.270.0070.01117.40
7.3.260.0170.00318.24
7.3.250.0110.00716.80
7.3.240.0110.00716.93
7.3.230.0080.01416.78
7.3.210.0070.01316.60
7.3.200.0120.00419.39
7.3.190.0060.01116.79
7.3.180.0150.00016.57
7.3.170.0110.00516.74
7.3.160.0030.01316.57
7.3.120.0100.00615.03
7.3.10.0130.00716.53
7.3.00.0140.00916.32
7.2.330.0120.00617.03
7.2.320.0090.00917.16
7.2.310.0000.01917.14
7.2.300.0130.01017.15
7.2.290.0040.01317.06
7.2.130.0170.00316.97
7.2.120.0110.00916.64
7.2.110.0120.01116.73
7.2.100.0210.00316.83
7.2.90.0180.00416.91
7.2.80.0080.00816.91
7.2.70.0040.01416.75
7.2.60.0090.00716.82
7.2.50.0100.01316.65
7.2.40.0070.01016.50
7.2.30.0150.00716.70
7.2.20.0050.00916.63
7.2.10.0150.00216.95
7.2.00.0070.00818.42
7.1.250.0120.00815.71
7.1.200.0000.01115.84
7.1.100.0080.00418.49
7.1.70.0040.00417.38
7.1.60.0130.01319.17
7.1.50.0090.01217.29
7.1.00.0070.04322.54
7.0.200.0060.00317.00
7.0.140.0000.07722.15
7.0.100.0030.04019.93
7.0.90.0000.04719.86
7.0.80.0030.04320.03
7.0.70.0070.06719.94
7.0.60.0030.03719.92
7.0.50.0070.06320.42
7.0.40.0130.06720.13
7.0.30.0030.06720.09
7.0.20.0130.07320.04
7.0.10.0100.08020.18
7.0.00.0070.08320.14
5.6.250.0030.04320.61
5.6.240.0030.04320.78
5.6.230.0070.07020.52
5.6.220.0000.04320.66
5.6.210.0000.05020.64
5.6.200.0100.07021.03
5.6.190.0030.04721.10
5.6.180.0130.06720.95
5.6.170.0030.08320.98
5.6.160.0000.08720.97
5.6.150.0100.04021.07
5.6.140.0000.08021.02
5.6.130.0000.09320.96
5.6.120.0100.05721.04
5.6.110.0100.08721.11
5.6.100.0100.06021.04
5.6.90.0070.05320.93
5.6.80.0170.06720.36
5.6.70.0170.06720.44
5.6.60.0030.05720.49
5.6.50.0070.08720.34
5.6.40.0030.07320.45
5.6.30.0070.08020.51
5.6.20.0030.07020.25
5.6.10.0070.08320.50
5.6.00.0070.07320.46
5.5.380.0070.03720.42
5.5.370.0030.04020.47
5.5.360.0030.06720.42
5.5.350.0030.04020.45
5.5.340.0170.04720.85
5.5.330.0100.07320.80
5.5.320.0170.05320.80
5.5.310.0130.04320.82
5.5.300.0030.05320.84
5.5.290.0100.05720.64
5.5.280.0070.05020.82
5.5.270.0030.05320.84
5.5.260.0070.08320.84
5.5.250.0070.08320.55
5.5.240.0030.04020.29
5.5.230.0130.07020.20
5.5.220.0030.06020.31
5.5.210.0070.08020.18
5.5.200.0100.08020.17
5.5.190.0070.05720.25
5.5.180.0100.08020.20
5.5.160.0000.08720.16
5.5.150.0030.08320.24
5.5.140.0170.07020.19
5.5.130.0070.07720.19
5.5.120.0100.04020.25
5.5.110.0070.08020.22
5.5.100.0130.06020.11
5.5.90.0100.07319.97
5.5.80.0100.08020.19
5.5.70.0030.09320.08
5.5.60.0070.08019.92
5.5.50.0100.07320.18
5.5.40.0170.07020.08
5.5.30.0070.08320.07
5.5.20.0100.07719.95
5.5.10.0100.09719.98
5.5.00.0170.06320.15
5.4.450.0070.07019.37
5.4.440.0130.07319.45
5.4.430.0030.04719.50
5.4.420.0000.09319.55
5.4.410.0030.08719.24
5.4.400.0030.07719.13
5.4.390.0030.04319.21
5.4.380.0100.07319.14
5.4.370.0100.07719.23
5.4.360.0130.06719.09
5.4.350.0070.05319.14
5.4.340.0100.07019.09
5.4.320.0100.07019.16
5.4.310.0100.07319.05
5.4.300.0170.06019.21
5.4.290.0170.03719.12
5.4.280.0100.04018.89
5.4.270.0100.07719.12
5.4.260.0030.08019.21
5.4.250.0000.07319.20
5.4.240.0070.07719.16
5.4.230.0070.08318.89
5.4.220.0000.08319.22
5.4.210.0030.08019.24
5.4.200.0170.06018.94
5.4.190.0030.08319.11
5.4.180.0070.07019.15
5.4.170.0100.05319.13
5.4.160.0100.06719.19
5.4.150.0130.07319.10
5.4.140.0070.07316.47
5.4.130.0070.06316.54
5.4.120.0030.04316.47
5.4.110.0100.05316.55
5.4.100.0070.07316.45
5.4.90.0070.06716.47
5.4.80.0100.06716.48
5.4.70.0130.06316.30
5.4.60.0100.04716.36
5.4.50.0070.07016.39
5.4.40.0030.04316.54
5.4.30.0030.07716.50
5.4.20.0070.07016.52
5.4.10.0100.06716.36
5.4.00.0070.07315.70
5.3.290.0070.08014.67
5.3.280.0100.07314.67
5.3.270.0070.05314.69
5.3.260.0100.07314.66
5.3.250.0030.08014.69
5.3.240.0000.04714.63
5.3.230.0030.08014.68
5.3.220.0030.04314.51
5.3.210.0070.06014.62
5.3.200.0100.04314.66
5.3.190.0130.06714.54
5.3.180.0030.05314.55
5.3.170.0000.06314.48
5.3.160.0230.04714.57
5.3.150.0030.07714.54
5.3.140.0030.07714.70
5.3.130.0100.05014.60
5.3.120.0100.06014.49
5.3.110.0070.07014.68
5.3.100.0070.04014.11
5.3.90.0030.04314.04
5.3.80.0170.06314.04
5.3.70.0070.08014.17
5.3.60.0070.07014.02
5.3.50.0070.07013.95
5.3.40.0070.05313.96
5.3.30.0100.05713.98
5.3.20.0070.06313.62
5.3.10.0130.06313.68
5.3.00.0230.05713.54
5.2.170.0100.06311.29
5.2.160.0030.06311.29
5.2.150.0070.05311.29
5.2.140.0030.05011.29
5.2.130.0130.05311.29
5.2.120.0100.05011.29
5.2.110.0130.05311.29
5.2.100.0030.06311.29
5.2.90.0030.05711.29
5.2.80.0070.04711.29
5.2.70.0000.07011.29
5.2.60.0000.05011.29
5.2.50.0070.05011.29
5.2.40.0030.03711.29
5.2.30.0030.04711.29
5.2.20.0070.05711.29
5.2.10.0070.06311.29
5.2.00.0100.05711.29
5.1.60.0000.03011.29
5.1.50.0000.04011.29
5.1.40.0070.05011.29
5.1.30.0030.04711.29
5.1.20.0030.06011.29
5.1.10.0070.05311.29
5.1.00.0100.02311.29
5.0.50.0030.02311.29
5.0.40.0030.04011.29
5.0.30.0070.06011.29
5.0.20.0000.04711.29
5.0.10.0100.03311.29
5.0.00.0100.05311.29
4.4.90.0000.03011.29
4.4.80.0000.03311.29
4.4.70.0030.03311.29
4.4.60.0030.02711.29
4.4.50.0030.03711.29
4.4.40.0030.04311.29
4.4.30.0000.03711.29
4.4.20.0030.03711.29
4.4.10.0070.03311.29
4.4.00.0000.03011.29
4.3.110.0100.02311.29
4.3.100.0030.02011.29
4.3.90.0030.02711.29
4.3.80.0070.05311.29
4.3.70.0000.03011.29
4.3.60.0030.03011.29
4.3.50.0000.02011.29
4.3.40.0130.04011.29
4.3.30.0000.02711.29
4.3.20.0030.03311.29
4.3.10.0000.03311.29
4.3.00.0000.03011.29

preferences:
38.7 ms | 401 KiB | 5 Q