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; 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, 1480554061); 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.0070.00718.56
8.3.50.0120.00921.39
8.3.40.0120.00319.06
8.3.30.0050.00820.38
8.3.20.0000.00720.32
8.3.10.0040.00422.03
8.3.00.0000.00822.46
8.2.180.0100.01017.00
8.2.170.0070.01122.96
8.2.160.0070.00722.25
8.2.150.0030.00524.18
8.2.140.0030.00524.66
8.2.130.0070.00026.16
8.2.120.0050.00320.88
8.2.110.0030.00620.51
8.2.100.0060.00918.09
8.2.90.0000.00819.55
8.2.80.0030.00519.52
8.2.70.0030.00617.88
8.2.60.0000.00818.04
8.2.50.0050.00318.07
8.2.40.0090.00018.22
8.2.30.0030.00619.59
8.2.20.0080.00018.11
8.2.10.0000.00818.19
8.2.00.0040.00418.05
8.1.280.0070.01125.92
8.1.270.0050.00323.99
8.1.260.0080.00026.35
8.1.250.0030.00628.09
8.1.240.0030.00724.16
8.1.230.0090.00318.03
8.1.220.0050.00317.89
8.1.210.0060.00318.77
8.1.200.0030.00617.73
8.1.190.0040.00418.03
8.1.180.0060.00318.10
8.1.170.0050.00318.96
8.1.160.0040.00419.07
8.1.150.0040.00418.88
8.1.140.0030.00517.76
8.1.130.0000.00817.97
8.1.120.0000.00717.72
8.1.110.0040.00417.84
8.1.100.0000.00917.81
8.1.90.0040.00417.69
8.1.80.0050.00317.85
8.1.70.0070.00017.72
8.1.60.0040.00417.90
8.1.50.0080.00017.69
8.1.40.0000.00817.70
8.1.30.0060.00317.95
8.1.20.0040.00417.93
8.1.10.0080.00017.78
8.1.00.0040.00417.84
8.0.300.0050.00219.09
8.0.290.0020.00517.55
8.0.280.0030.00518.70
8.0.270.0030.00317.42
8.0.260.0040.00417.13
8.0.250.0050.00317.36
8.0.240.0030.00617.26
8.0.230.0030.00317.37
8.0.220.0030.00317.25
8.0.210.0000.00717.34
8.0.200.0000.00617.41
8.0.190.0030.00517.30
8.0.180.0030.00517.24
8.0.170.0040.00417.34
8.0.160.0030.00517.40
8.0.150.0000.00717.27
8.0.140.0080.00017.26
8.0.130.0030.00313.71
8.0.120.0000.00717.28
8.0.110.0000.00717.38
8.0.100.0040.00417.37
8.0.90.0000.00717.18
8.0.80.0100.01017.30
8.0.70.0080.00017.39
8.0.60.0000.00717.23
8.0.50.0000.00817.39
8.0.30.0060.01317.36
8.0.20.0130.01117.51
8.0.10.0040.00417.40
8.0.00.0070.01217.22
7.4.330.0020.00216.95
7.4.320.0030.00316.91
7.4.300.0060.00016.84
7.4.290.0030.00316.92
7.4.280.0000.00716.82
7.4.270.0000.00716.91
7.4.260.0000.00513.53
7.4.250.0040.00416.77
7.4.240.0010.00616.78
7.4.230.0030.00317.01
7.4.220.0150.00316.91
7.4.210.0070.00916.88
7.4.200.0040.00417.02
7.4.190.0000.00716.98
7.4.160.0150.00916.84
7.4.150.0160.00917.40
7.4.140.0100.00617.86
7.4.130.0130.00916.86
7.4.120.0120.00616.89
7.4.110.0040.01616.88
7.4.100.0120.00916.90
7.4.90.0110.00816.81
7.4.80.0090.01319.39
7.4.70.0090.01016.71
7.4.60.0060.01217.02
7.4.50.0060.00316.65
7.4.40.0070.01022.77
7.4.30.0180.00617.01
7.4.00.0040.00715.13
7.3.330.0000.00513.61
7.3.320.0050.00013.64
7.3.310.0070.00016.55
7.3.300.0040.00416.66
7.3.290.0040.00916.61
7.3.280.0120.00516.64
7.3.270.0120.00617.40
7.3.260.0110.00718.24
7.3.250.0050.01216.76
7.3.240.0110.01116.68
7.3.230.0030.01316.70
7.3.210.0060.01616.98
7.3.200.0060.01219.39
7.3.190.0150.00716.70
7.3.180.0060.01016.77
7.3.170.0030.01316.73
7.3.160.0140.00916.73
7.3.120.0090.00615.09
7.3.10.0030.00716.81
7.3.00.0060.00616.72
7.2.330.0070.01017.05
7.2.320.0100.01116.93
7.2.310.0140.00317.15
7.2.300.0100.00717.16
7.2.290.0130.00316.95
7.2.130.0070.00717.35
7.2.120.0110.00017.35
7.2.110.0040.00817.24
7.2.100.0070.00717.18
7.2.90.0080.00617.21
7.2.80.0030.01017.17
7.2.70.0090.00617.38
7.2.60.0080.00417.09
7.2.50.0100.00017.17
7.2.40.0030.00716.96
7.2.30.0070.00717.15
7.2.20.0060.00617.28
7.2.10.0100.00317.36
7.2.00.0060.00818.51
7.1.250.0040.00416.13
7.1.200.0030.01315.87
7.1.100.0030.00718.25
7.1.70.0090.00317.18
7.1.60.0040.02219.17
7.1.50.0090.01517.25
7.1.00.0030.05722.28
7.0.200.0040.01217.04
7.0.140.0000.07722.12
7.0.90.0100.04320.07
7.0.80.0100.04720.00
7.0.70.0100.08719.93
7.0.60.0100.05019.99
7.0.50.0070.05020.39
7.0.40.0070.07020.12
7.0.30.0130.07720.05
7.0.20.0130.08020.13
7.0.10.0100.04720.14
7.0.00.0070.10020.07
5.6.280.0030.07321.17
5.6.240.0070.09020.67
5.6.230.0100.06720.70
5.6.220.0130.07320.58
5.6.210.0100.07020.51
5.6.200.0070.05320.97
5.6.190.0070.06321.10
5.6.180.0130.08720.95
5.6.170.0130.07020.99
5.6.160.0070.08021.11
5.6.150.0100.07720.96
5.6.140.0070.07721.09
5.6.130.0070.07021.18
5.6.120.0070.04321.07
5.6.110.0130.03721.02
5.6.100.0030.08721.11
5.6.90.0100.07021.01
5.6.80.0100.05720.52
5.6.70.0100.08020.44
5.6.60.0030.07720.44
5.6.50.0130.07720.59
5.6.40.0000.06720.51
5.6.30.0070.06320.52
5.6.20.0070.04720.42
5.6.10.0070.07020.48
5.6.00.0130.07020.43
5.5.380.0070.07020.41
5.5.370.0230.07020.58
5.5.360.0070.05720.42
5.5.350.0070.04020.44
5.5.340.0000.05320.92
5.5.330.0070.07320.91
5.5.320.0130.05020.93
5.5.310.0100.05720.82
5.5.300.0230.06020.86
5.5.290.0000.04720.85
5.5.280.0100.05020.91
5.5.270.0070.08320.81
5.5.260.0170.08020.88
5.5.250.0000.04320.64
5.5.240.0030.07320.23
5.5.230.0070.03320.26
5.5.220.0070.03720.13
5.5.210.0070.07020.24
5.5.200.0030.06020.21
5.5.190.0070.03720.18
5.5.180.0100.03020.20
5.5.160.0130.04720.13
5.5.150.0000.05020.16
5.5.140.0000.04320.23
5.5.130.0070.03320.29
5.5.120.0000.04020.23
5.5.110.0070.05320.25
5.5.100.0000.03719.93
5.5.90.0070.07020.09
5.5.80.0030.04320.09
5.5.70.0070.07720.14
5.5.60.0070.07720.16
5.5.50.0070.03719.95
5.5.40.0030.03320.18
5.5.30.0100.07720.07
5.5.20.0030.07320.02
5.5.10.0000.03720.11
5.5.00.0070.07020.04
5.4.450.0000.04019.21
5.4.440.0070.06319.27
5.4.430.0000.04019.22
5.4.420.0000.04319.48
5.4.410.0000.08719.07
5.4.400.0070.07319.21
5.4.390.0070.05319.15
5.4.380.0030.03319.14
5.4.370.0030.07319.09
5.4.360.0070.03018.85
5.4.350.0030.04319.04
5.4.340.0030.06319.21
5.4.320.0130.05719.20
5.4.310.0100.04019.03
5.4.300.0000.08719.03
5.4.290.0000.05019.13
5.4.280.0100.06319.02
5.4.270.0030.07319.12
5.4.260.0030.05319.12
5.4.250.0070.03319.15
5.4.240.0070.03019.02
5.4.230.0130.04318.89
5.4.220.0170.06719.12
5.4.210.0100.03319.12
5.4.200.0000.03319.13
5.4.190.0030.07718.84
5.4.180.0000.03719.03
5.4.170.0000.08318.89
5.4.160.0100.06319.10
5.4.150.0070.07719.03
5.4.140.0070.03716.51
5.4.130.0070.07316.46
5.4.120.0000.04016.29
5.4.110.0070.07316.56
5.4.100.0100.06316.49
5.4.90.0130.06316.59
5.4.80.0070.07016.56
5.4.70.0170.06716.47
5.4.60.0170.05716.43
5.4.50.0100.06016.39
5.4.40.0070.04716.51
5.4.30.0030.07716.30
5.4.20.0100.06316.36
5.4.10.0100.06016.36
5.4.00.0100.06315.79
5.3.290.0070.06714.82
5.3.280.0070.08014.72
5.3.270.0130.07014.68
5.3.260.0070.07714.69
5.3.250.0070.03314.68
5.3.240.0030.04014.62
5.3.230.0100.05014.71
5.3.220.0030.07314.70
5.3.210.0070.07714.65
5.3.200.0000.07314.52
5.3.190.0070.02714.61
5.3.180.0000.05314.69
5.3.170.0030.07714.64
5.3.160.0070.06314.56
5.3.150.0100.07014.55
5.3.140.0070.03314.58
5.3.130.0070.07014.63
5.3.120.0030.08014.58
5.3.110.0030.07014.56
5.3.100.0030.04314.11
5.3.90.0100.04014.14
5.3.80.0070.07313.94
5.3.70.0030.04014.13
5.3.60.0070.06013.91
5.3.50.0100.06014.03
5.3.40.0100.04714.07
5.3.30.0030.06014.06
5.3.20.0000.04713.69
5.3.10.0030.07013.81
5.3.00.0030.07713.65
5.2.170.0000.05711.22
5.2.160.0030.03311.05
5.2.150.0100.06011.02
5.2.140.0070.03711.15
5.2.130.0030.03011.01
5.2.120.0070.05311.14
5.2.110.0030.04711.11
5.2.100.0030.06011.18
5.2.90.0000.06010.98
5.2.80.0030.06311.10
5.2.70.0070.03011.18
5.2.60.0070.06011.21
5.2.50.0030.04011.13
5.2.40.0030.05311.05
5.2.30.0070.03010.90
5.2.20.0000.03310.99
5.2.10.0100.04710.97
5.2.00.0000.03310.75
5.1.60.0000.04310.43
5.1.50.0100.04310.43
5.1.40.0030.02310.43
5.1.30.0070.05010.43
5.1.20.0130.04010.43
5.1.10.0000.05310.43
5.1.00.0030.06010.43
5.0.50.0000.04310.43
5.0.40.0070.03310.43
5.0.30.0030.03010.43
5.0.20.0000.02010.43
5.0.10.0070.03310.43
5.0.00.0070.04010.43
4.4.90.0030.01710.43
4.4.80.0000.03310.43
4.4.70.0070.01010.43
4.4.60.0000.01710.43
4.4.50.0030.01710.43
4.4.40.0070.04710.43
4.4.30.0030.03310.43
4.4.20.0000.04310.43
4.4.10.0070.01010.43
4.4.00.0000.03710.43
4.3.110.0000.01710.43
4.3.100.0070.02710.43
4.3.90.0000.03010.43
4.3.80.0070.02010.43
4.3.70.0000.03310.43
4.3.60.0000.01710.43
4.3.50.0000.03010.43
4.3.40.0000.02710.43
4.3.30.0000.03010.43
4.3.20.0000.02010.43
4.3.10.0000.01710.43
4.3.00.0000.01710.43

preferences:
35.62 ms | 401 KiB | 5 Q