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 = floor($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, 51417392000); 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.0120.00618.40
8.3.50.0150.00821.20
8.3.40.0110.01119.17
8.3.30.0080.00620.13
8.3.20.0080.00020.34
8.3.10.0080.00022.10
8.3.00.0040.00422.30
8.2.180.0170.00316.75
8.2.170.0110.01122.96
8.2.160.0070.00722.30
8.2.150.0040.00424.18
8.2.140.0000.00824.66
8.2.130.0040.00426.16
8.2.120.0040.00420.86
8.2.110.0110.01122.25
8.2.100.0120.00018.16
8.2.90.0000.00818.42
8.2.80.0060.00319.59
8.2.70.0060.00318.00
8.2.60.0000.00818.18
8.2.50.0040.00418.07
8.2.40.0050.00318.15
8.2.30.0000.00719.60
8.2.20.0040.00418.07
8.2.10.0000.00818.16
8.2.00.0030.00518.11
8.1.280.0120.00625.92
8.1.270.0050.00323.99
8.1.260.0060.00326.35
8.1.250.0040.00428.09
8.1.240.0120.00024.03
8.1.230.0080.00319.28
8.1.220.0000.00817.91
8.1.210.0030.00619.16
8.1.200.0040.00417.60
8.1.190.0000.00817.66
8.1.180.0000.00818.10
8.1.170.0000.00819.09
8.1.160.0040.00418.98
8.1.150.0040.00418.82
8.1.140.0030.00517.76
8.1.130.0040.00418.02
8.1.120.0040.00417.80
8.1.110.0040.00417.80
8.1.100.0000.00817.66
8.1.90.0000.00717.80
8.1.80.0000.00717.73
8.1.70.0000.00717.76
8.1.60.0090.00017.85
8.1.50.0080.00017.78
8.1.40.0000.00917.78
8.1.30.0040.00417.75
8.1.20.0000.00817.96
8.1.10.0070.00017.78
8.1.00.0060.00317.80
8.0.300.0040.00420.36
8.0.290.0000.00717.41
8.0.280.0080.00018.55
8.0.270.0000.00817.35
8.0.260.0000.00717.26
8.0.250.0000.00817.34
8.0.240.0030.00517.34
8.0.230.0040.00417.29
8.0.220.0000.00817.18
8.0.210.0000.00717.16
8.0.200.0030.00317.31
8.0.190.0090.00017.21
8.0.180.0040.00417.19
8.0.170.0030.00517.23
8.0.160.0070.00017.13
8.0.150.0000.00717.25
8.0.140.0000.00717.18
8.0.130.0060.00013.66
8.0.120.0030.00617.24
8.0.110.0050.00217.26
8.0.100.0050.00317.13
8.0.90.0000.00817.27
8.0.80.0120.00617.22
8.0.70.0000.00817.25
8.0.60.0040.00417.13
8.0.50.0040.00417.26
8.0.30.0060.01617.50
8.0.20.0140.00917.57
8.0.10.0070.00017.26
8.0.00.0140.00817.11
7.4.330.0020.00216.80
7.4.320.0000.00716.76
7.4.300.0070.00016.86
7.4.290.0000.00716.68
7.4.280.0040.00416.84
7.4.270.0030.00316.68
7.4.260.0030.00313.46
7.4.250.0050.00316.74
7.4.240.0000.00716.84
7.4.230.0000.00716.51
7.4.220.0140.00316.65
7.4.210.0110.00516.89
7.4.200.0080.00016.88
7.4.190.0080.00016.70
7.4.160.0060.01216.73
7.4.150.0090.00917.40
7.4.140.0100.00917.86
7.4.130.0140.00916.72
7.4.120.0100.00716.87
7.4.110.0000.02116.88
7.4.100.0070.01116.71
7.4.90.0190.00616.89
7.4.80.0160.00319.39
7.4.70.0100.00716.64
7.4.60.0030.01516.91
7.4.50.0030.00616.89
7.4.40.0150.00322.77
7.4.30.0120.01316.94
7.4.00.0060.01015.48
7.3.330.0000.00513.41
7.3.320.0000.00613.38
7.3.310.0030.00316.49
7.3.300.0040.00416.52
7.3.290.0140.00016.64
7.3.280.0130.00316.54
7.3.270.0110.00617.40
7.3.260.0120.00618.24
7.3.250.0120.00416.62
7.3.240.0040.01216.81
7.3.230.0080.01116.78
7.3.210.0070.01016.69
7.3.200.0160.00619.39
7.3.190.0070.01016.77
7.3.180.0060.01216.89
7.3.170.0110.00516.94
7.3.160.0120.00916.59
7.3.120.0100.00815.20
7.3.110.0060.00915.12
7.3.100.0000.01415.08
7.3.90.0000.00915.29
7.3.80.0030.00615.27
7.3.70.0060.00614.80
7.3.60.0000.00914.88
7.3.50.0070.00715.04
7.3.40.0060.00915.18
7.3.30.0040.00715.01
7.3.20.0070.00316.63
7.3.10.0090.00316.72
7.3.00.0030.00716.79
7.2.330.0140.00316.74
7.2.320.0200.00416.90
7.2.310.0090.01317.12
7.2.300.0080.00816.73
7.2.290.0110.00616.77
7.2.250.0060.01214.98
7.2.240.0060.01215.46
7.2.230.0110.00415.32
7.2.220.0000.00915.32
7.2.210.0040.00815.27
7.2.200.0080.00415.25
7.2.190.0090.00315.50
7.2.180.0030.01215.27
7.2.170.0000.01415.38
7.2.60.0100.00317.04
7.2.00.0000.01519.70
7.1.330.0040.01115.93
7.1.320.0060.00915.91
7.1.310.0070.00315.78
7.1.300.0030.01016.03
7.1.290.0030.01016.15
7.1.280.0110.00016.13
7.1.270.0140.00416.16
7.1.260.0040.01116.20
7.1.200.0060.00815.75
7.1.100.0060.00618.32
7.1.70.0070.00017.43
7.1.60.0100.01419.17
7.1.50.0130.01017.36
7.1.00.0000.06022.54
7.0.200.0000.01016.87
7.0.140.0030.07322.04
7.0.80.0670.06019.89
7.0.70.0530.04019.97
7.0.60.0700.07019.90
7.0.50.0770.07020.28
7.0.40.0100.08020.03
7.0.30.0170.08020.14
7.0.20.0030.05319.96
7.0.10.0000.08320.06
7.0.00.0200.06720.10
5.6.280.0000.07721.11
5.6.230.0070.07720.52
5.6.220.0000.08720.67
5.6.210.0070.04320.64
5.6.200.0130.04321.07
5.6.190.0100.05320.95
5.6.180.0100.07721.12
5.6.170.0070.08321.11
5.6.160.0100.05321.16
5.6.150.0070.04021.10
5.6.140.0070.05721.12
5.6.130.0030.04721.15
5.6.120.0070.07721.14
5.6.110.0130.05021.04
5.6.100.0130.08021.11
5.6.90.0100.07721.06
5.6.80.0100.08020.52
5.6.70.0070.08320.40
5.6.60.0200.07320.45
5.6.50.0030.07720.49
5.6.40.0070.08320.32
5.6.30.0170.07320.48
5.6.20.0070.04720.47
5.6.10.0030.08320.33
5.6.00.0030.08320.53
5.5.370.0130.07720.38
5.5.360.0100.07320.41
5.5.350.0100.08020.44
5.5.340.0130.07320.82
5.5.330.0070.05320.80
5.5.320.0170.06320.75
5.5.310.0030.08720.82
5.5.300.0100.08320.86
5.5.290.0130.07320.91
5.5.280.0100.08320.92
5.5.270.0100.08720.95
5.5.260.0100.08720.62
5.5.250.0100.07720.63
5.5.240.0100.05720.34
5.5.230.0070.05320.04
5.5.220.0100.07720.32
5.5.210.0100.08020.28
5.5.200.0070.06720.29
5.5.190.0100.06020.26
5.5.180.0030.08020.00
5.5.160.0070.05720.30
5.5.150.0100.08320.27
5.5.140.0070.05720.10
5.5.130.0100.08020.25
5.5.120.0100.07020.23
5.5.110.0070.06720.14
5.5.100.0030.08320.17
5.5.90.0070.05720.06
5.5.80.0100.07319.96
5.5.70.0030.08320.09
5.5.60.0100.07320.11
5.5.50.0230.07320.05
5.5.40.0070.06020.02
5.5.30.0170.07020.17
5.5.20.0170.07320.09
5.5.10.0030.05719.98
5.5.00.0100.04720.00
5.4.450.0170.07319.37
5.4.440.0070.04719.17
5.4.430.0130.07719.52
5.4.420.0100.08719.44
5.4.410.0070.07719.27
5.4.400.0070.07319.04
5.4.390.0170.06318.85
5.4.380.0130.07319.12
5.4.370.0070.04719.07
5.4.360.0100.07719.09
5.4.350.0100.07719.23
5.4.340.0070.05019.24
5.4.320.0070.07719.21
5.4.310.0000.05019.23
5.4.300.0070.03719.12
5.4.290.0070.07019.02
5.4.280.0070.08019.13
5.4.270.0070.07319.04
5.4.260.0070.08019.03
5.4.250.0100.07718.90
5.4.240.0100.07319.15
5.4.230.0030.08018.90
5.4.220.0070.07719.20
5.4.210.0100.06718.89
5.4.200.0070.08319.19
5.4.190.0100.05319.21
5.4.180.0100.05719.28
5.4.170.0170.07019.08
5.4.160.0070.05019.12
5.4.150.0070.08019.02
5.4.140.0000.06016.39
5.4.130.0030.07716.46
5.4.120.0100.06016.24
5.4.110.0100.07316.32
5.4.100.0030.07316.39
5.4.90.0100.07316.41
5.4.80.0130.07016.50
5.4.70.0100.07316.51
5.4.60.0070.05716.52
5.4.50.0100.06716.34
5.4.40.0170.07316.38
5.4.30.0100.04016.40
5.4.20.0070.07016.36
5.4.10.0100.05016.39
5.4.00.0070.07315.85
5.3.290.0130.05714.78
5.3.280.0100.05014.60
5.3.270.0000.08714.76
5.3.260.0070.07714.64
5.3.250.0100.05314.68
5.3.240.0030.06714.58
5.3.230.0070.07014.68
5.3.220.0130.07314.55
5.3.210.0030.06714.57
5.3.200.0030.05314.64
5.3.190.0170.06314.65
5.3.180.0170.05714.54
5.3.170.0070.07714.57
5.3.160.0070.06314.55
5.3.150.0030.05014.52
5.3.140.0070.07314.67
5.3.130.0070.07314.52
5.3.120.0070.05714.60
5.3.110.0000.07014.60
5.3.100.0100.06014.04
5.3.90.0000.08013.99
5.3.80.0070.07014.10
5.3.70.0000.08014.13
5.3.60.0070.07013.96
5.3.50.0000.06713.86
5.3.40.0100.06314.11
5.3.30.0030.05013.85
5.3.20.0030.07013.71
5.3.10.0030.07313.73
5.3.00.0000.04313.58
5.2.170.0030.05311.20
5.2.160.0070.03311.22
5.2.150.0030.03011.04
5.2.140.0100.06311.15
5.2.130.0070.06011.05
5.2.120.0070.02711.19
5.2.110.0000.04011.20
5.2.100.0000.04011.05
5.2.90.0000.03311.04
5.2.80.0130.02311.22
5.2.70.0030.03011.10
5.2.60.0000.03011.13
5.2.50.0000.03010.93
5.2.40.0000.03010.93
5.2.30.0070.02711.05
5.2.20.0030.02711.10
5.2.10.0070.02310.78
5.2.00.0000.03010.75
5.1.60.0000.0379.92
5.1.50.0000.02710.08
5.1.40.0070.02010.08
5.1.30.0030.02710.48
5.1.20.0030.02710.51
5.1.10.0030.03010.17
5.1.00.0070.02010.08
5.0.50.0000.0408.68
5.0.40.0030.0278.49
5.0.30.0000.0338.35
5.0.20.0070.0408.34
5.0.10.0000.0478.26
5.0.00.0000.0478.18
4.4.90.0000.0178.18
4.4.80.0000.0178.18
4.4.70.0000.0178.18
4.4.60.0030.0208.18
4.4.50.0000.0178.18
4.4.40.0000.0278.18
4.4.30.0000.0178.18
4.4.20.0030.0138.18
4.4.10.0000.0178.18
4.4.00.0030.0238.18
4.3.110.0000.0338.18
4.3.100.0000.0408.18
4.3.90.0000.0278.18
4.3.80.0000.0508.18
4.3.70.0030.0338.18
4.3.60.0030.0278.18
4.3.50.0030.0338.18
4.3.40.0000.0478.18
4.3.30.0030.0178.18
4.3.20.0000.0238.18
4.3.10.0000.0178.18
4.3.00.0000.0308.18

preferences:
48.04 ms | 401 KiB | 5 Q