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, 1454198400); 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.70.0110.01116.75
8.3.60.0070.00718.36
8.3.50.0140.00522.05
8.3.40.0000.01519.04
8.3.30.0100.00320.36
8.3.20.0030.00619.02
8.3.10.0050.00321.20
8.3.00.0050.00222.39
8.2.180.0150.00016.63
8.2.170.0100.01022.96
8.2.160.0070.00720.47
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0080.00026.16
8.2.120.0040.00419.95
8.2.110.0070.00320.64
8.2.100.0120.00018.16
8.2.90.0000.00719.30
8.2.80.0080.00019.46
8.2.70.0050.00317.88
8.2.60.0040.00418.29
8.2.50.0100.00318.07
8.2.40.0040.00418.47
8.2.30.0000.00721.27
8.2.20.0000.00818.17
8.2.10.0040.00418.29
8.2.00.0100.00018.16
8.1.280.0070.00725.92
8.1.270.0030.00523.99
8.1.260.0040.00426.35
8.1.250.0080.00028.09
8.1.240.0090.00422.12
8.1.230.0060.00622.37
8.1.220.0000.00818.77
8.1.210.0030.00518.97
8.1.200.0050.00517.85
8.1.190.0080.00017.77
8.1.180.0030.00718.10
8.1.170.0080.00018.84
8.1.160.0000.00719.21
8.1.150.0030.00618.88
8.1.140.0000.00717.74
8.1.130.0030.00518.07
8.1.120.0030.00917.73
8.1.110.0030.00617.85
8.1.100.0000.00717.84
8.1.90.0050.00217.82
8.1.80.0030.00517.83
8.1.70.0030.00517.68
8.1.60.0030.00617.88
8.1.50.0050.00217.80
8.1.40.0030.00517.86
8.1.30.0050.00317.81
8.1.20.0040.00417.94
8.1.10.0030.00517.79
8.1.00.0050.00217.92
8.0.300.0060.00320.23
8.0.290.0000.00717.55
8.0.280.0030.00318.70
8.0.270.0070.00017.56
8.0.260.0030.00318.70
8.0.250.0040.00417.39
8.0.240.0060.00317.34
8.0.230.0040.00417.38
8.0.220.0040.00417.36
8.0.210.0000.00717.35
8.0.200.0060.00017.42
8.0.190.0040.00417.39
8.0.180.0080.00017.25
8.0.170.0050.00317.34
8.0.160.0040.00417.39
8.0.150.0030.00517.26
8.0.140.0040.00417.37
8.0.130.0000.00613.73
8.0.120.0000.00817.26
8.0.110.0080.00017.36
8.0.100.0050.00317.32
8.0.90.0050.00317.18
8.0.80.0110.00417.37
8.0.70.0000.00817.23
8.0.60.0040.00417.36
8.0.50.0040.00417.32
8.0.30.0090.01317.36
8.0.20.0110.01217.66
8.0.10.0040.00417.41
8.0.00.0090.01217.06
7.4.330.0000.00516.96
7.4.320.0040.00416.92
7.4.300.0040.00416.95
7.4.290.0000.00816.94
7.4.280.0000.00816.91
7.4.270.0040.00416.83
7.4.260.0050.00013.55
7.4.250.0040.00416.92
7.4.240.0000.00816.81
7.4.230.0040.00416.81
7.4.220.0110.00716.96
7.4.210.0070.00816.91
7.4.200.0000.00716.89
7.4.190.0000.00716.87
7.4.160.0100.01416.80
7.4.150.0090.00917.40
7.4.140.0120.00917.86
7.4.130.0130.00616.79
7.4.120.0070.01116.87
7.4.110.0100.00716.72
7.4.100.0100.00716.79
7.4.90.0070.01016.77
7.4.80.0040.01319.39
7.4.70.0060.01416.81
7.4.60.0140.00316.84
7.4.50.0050.00316.82
7.4.40.0030.01422.77
7.4.30.0040.01516.76
7.4.00.0130.00315.42
7.3.330.0050.00013.46
7.3.320.0050.00013.54
7.3.310.0030.00316.59
7.3.300.0040.00416.70
7.3.290.0110.00416.67
7.3.280.0060.01216.67
7.3.270.0100.01017.40
7.3.260.0080.01218.24
7.3.250.0110.00816.83
7.3.240.0140.00416.97
7.3.230.0000.01716.66
7.3.210.0030.01617.01
7.3.200.0030.01419.39
7.3.190.0060.01116.93
7.3.180.0120.00416.70
7.3.170.0040.01216.75
7.3.160.0080.00816.73
7.3.120.0080.00615.24
7.2.330.0110.00617.14
7.2.320.0080.01317.21
7.2.310.0110.00916.97
7.2.300.0090.00917.26
7.2.290.0080.00817.03
7.2.00.0080.01219.27
7.1.200.0060.00915.85
7.1.100.0030.00918.16
7.1.70.0000.00817.51
7.1.60.0130.01319.24
7.1.50.0060.01517.20
7.1.00.0000.06022.27
7.0.200.0040.00417.08
7.0.140.0000.07721.92
7.0.80.0670.07720.03
7.0.70.0630.08019.94
7.0.60.0430.08719.99
7.0.50.0500.08320.39
7.0.40.0070.05720.15
7.0.30.0070.08719.95
7.0.20.0030.08320.03
7.0.10.0100.07720.13
7.0.00.0000.05020.08
5.6.280.0030.07020.93
5.6.230.0200.06720.62
5.6.220.0100.05720.67
5.6.210.0000.05320.72
5.6.200.0070.05021.06
5.6.190.0170.06321.18
5.6.180.0100.05721.15
5.6.170.0030.09021.08
5.6.160.0200.06321.10
5.6.150.0130.04321.02
5.6.140.0100.07021.13
5.6.130.0130.05020.97
5.6.120.0030.08721.12
5.6.110.0130.05320.96
5.6.100.0070.07320.96
5.6.90.0030.04021.08
5.6.80.0030.05720.34
5.6.70.0100.03320.44
5.6.60.0030.03720.40
5.6.50.0070.04320.51
5.6.40.0130.03320.45
5.6.30.0100.03020.48
5.6.20.0030.04020.38
5.6.10.0070.06320.33
5.6.00.0030.04320.40
5.5.370.0070.08020.59
5.5.360.0070.05720.36
5.5.350.0100.05720.40
5.5.340.0070.07720.95
5.5.330.0070.08020.80
5.5.320.0000.08720.92
5.5.310.0100.08020.84
5.5.300.0070.08720.86
5.5.290.0030.08720.66
5.5.280.0070.04020.86
5.5.270.0070.07720.91
5.5.260.0070.08720.85
5.5.250.0100.03320.75
5.5.240.0070.03720.20
5.5.230.0100.03020.26
5.5.220.0030.04020.19
5.5.210.0000.04320.23
5.5.200.0000.04020.20
5.5.190.0030.04320.23
5.5.180.0030.08020.11
5.5.160.0100.03020.27
5.5.150.0070.03320.27
5.5.140.0070.03720.14
5.5.130.0100.07720.10
5.5.120.0030.04020.23
5.5.110.0000.04320.19
5.5.100.0070.03020.18
5.5.90.0100.03320.16
5.5.80.0070.03320.12
5.5.70.0000.04320.13
5.5.60.0030.03720.17
5.5.50.0000.03720.17
5.5.40.0030.03319.95
5.5.30.0130.03020.11
5.5.20.0030.04020.16
5.5.10.0070.03320.02
5.5.00.0030.04020.10
5.4.450.0030.06719.51
5.4.440.0030.08019.23
5.4.430.0100.03719.53
5.4.420.0030.03719.53
5.4.410.0070.03719.22
5.4.400.0070.03719.05
5.4.390.0070.04019.31
5.4.380.0030.04019.10
5.4.370.0070.03318.91
5.4.360.0000.04318.97
5.4.350.0000.03719.09
5.4.340.0000.04019.30
5.4.320.0070.03319.01
5.4.310.0030.04719.05
5.4.300.0000.04719.18
5.4.290.0100.02719.04
5.4.280.0130.04719.15
5.4.270.0030.03319.09
5.4.260.0070.03018.94
5.4.250.0070.03719.13
5.4.240.0030.03719.11
5.4.230.0000.04319.08
5.4.220.0000.03719.20
5.4.210.0100.04019.19
5.4.200.0070.05719.28
5.4.190.0070.03319.19
5.4.180.0000.05718.92
5.4.170.0070.04019.03
5.4.160.0030.03719.28
5.4.150.0100.04319.16
5.4.140.0000.04016.48
5.4.130.0070.03316.44
5.4.120.0070.03316.60
5.4.110.0070.03716.38
5.4.100.0000.04716.55
5.4.90.0130.06016.38
5.4.80.0100.05716.51
5.4.70.0000.08316.44
5.4.60.0030.08716.43
5.4.50.0070.06716.30
5.4.40.0100.06716.35
5.4.30.0030.05716.51
5.4.20.0130.04716.50
5.4.10.0100.06316.57
5.4.00.0100.07015.92
5.3.290.0030.04014.70
5.3.280.0100.02714.60
5.3.270.0030.04014.63
5.3.260.0000.03714.74
5.3.250.0000.04014.65
5.3.240.0000.04014.68
5.3.230.0100.03714.67
5.3.220.0030.03714.64
5.3.210.0100.03014.60
5.3.200.0030.04014.73
5.3.190.0130.05314.68
5.3.180.0070.03714.71
5.3.170.0070.05714.61
5.3.160.0030.08014.72
5.3.150.0070.07714.71
5.3.140.0030.07314.69
5.3.130.0070.07714.70
5.3.120.0030.05014.69
5.3.110.0100.07014.60
5.3.100.0170.07014.04
5.3.90.0070.07014.18
5.3.80.0170.07014.03
5.3.70.0070.07713.99
5.3.60.0170.06714.14
5.3.50.0130.07014.02
5.3.40.0070.07714.07
5.3.30.0130.06714.07
5.3.20.0030.04313.77
5.3.10.0070.03713.59
5.3.00.0070.06013.71
5.2.170.0000.04711.49
5.2.160.0030.04311.49
5.2.150.0070.04311.32
5.2.140.0130.05711.30
5.2.130.0000.04311.24
5.2.120.0000.06711.17
5.2.110.0030.06311.27
5.2.100.0070.06011.37
5.2.90.0070.05311.37
5.2.80.0000.04011.29
5.2.70.0100.05711.36
5.2.60.0130.05711.20
5.2.50.0130.02011.24
5.2.40.0070.04311.07
5.2.30.0000.03311.23
5.2.20.0070.03711.09
5.2.10.0070.06010.97
5.2.00.0100.05710.99
5.1.60.0070.03010.29
5.1.50.0030.03310.25
5.1.40.0030.05710.18
5.1.30.0030.03710.53
5.1.20.0170.03710.45
5.1.10.0070.05710.34
5.1.00.0030.04310.13
5.0.50.0070.0438.70
5.0.40.0030.0278.68
5.0.30.0070.0478.52
5.0.20.0000.0308.25
5.0.10.0100.0378.46
5.0.00.0100.0508.43
4.4.90.0000.0408.07
4.4.80.0000.0338.07
4.4.70.0070.0308.07
4.4.60.0030.0208.07
4.4.50.0000.0208.07
4.4.40.0000.0278.07
4.4.30.0030.0278.07
4.4.20.0070.0338.07
4.4.10.0000.0208.07
4.4.00.0030.0438.07
4.3.110.0000.0238.07
4.3.100.0000.0478.07
4.3.90.0000.0378.07
4.3.80.0030.0538.07
4.3.70.0070.0208.07
4.3.60.0000.0238.07
4.3.50.0030.0178.07
4.3.40.0100.0208.07
4.3.30.0000.0208.07
4.3.20.0000.0208.07
4.3.10.0070.0278.07
4.3.00.0000.0308.07

preferences:
51.91 ms | 401 KiB | 5 Q