3v4l.org

run code in 300+ PHP versions simultaneously
<?php date_default_timezone_set('UTC'); function dateDiff($startdate, $enddate) { $first = $startdate < $enddate ? $startdate : $enddate; $second = $startdate < $enddate ? $enddate : $startdate; $inbetween = $second - $first; $firsttemp = $first; $months = 0; $days = 0; while(TRUE) { if($firsttemp + 86400* date('t', $firsttemp) <= $second) { $months += 1; $firsttemp += 86400 * date('t', $firsttemp); } else { $days = floor(($second - $firsttemp) / 86400); break; } } $years = floor($months / 12); $months = $months % 12; $hours = floor($inbetween / 60 / 60 % 24); $minutes = floor($inbetween / 60 % 60); $seconds = $inbetween % 60; $dateObj = new stdClass(); $dateObj->years = $years; $dateObj->months = $months; $dateObj->days = $days; $dateObj->hours = $hours; $dateObj->minutes = $minutes; $dateObj->seconds = $seconds; $dateObj->dayyyy = floor($inbetween / 60 / 60 / 24); return $dateObj; } $str1 = "1970-01-01 + 21 sec"; $str2 = "2009-01-01 + 54612 sec"; $tempdate1 = $str1; $date1 = new DateTime($str1); $n = 0; $date2 = new DateTime($str2); $interval = $date1->diff($date2); $string1 = "(" . $interval->days . ") difference " . $interval->y . " years, " . $interval->m . " months, " . $interval->d . " days"; $mydate = dateDiff(strtotime($str1), strtotime($str2)); $string2 = "(" . $mydate->dayyyy . ") difference " . $mydate->years . " years, " . $mydate->months . " months, " . $mydate->days . " days"; if($string1 !== $string2) { echo "<span style=\"color:red;\">", $string1, " - ", $string2, "</span><br />"; // This will never run } else { echo "<span style=\"color:green;\">", $string1, " - ", $string2, "</span><br />"; } $n++; $tempdate1 = $str1 . " +" . $n . " days";

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.0150.00016.75
8.3.50.0130.00517.57
8.3.40.0120.00318.97
8.3.30.0090.00618.96
8.3.20.0090.00018.90
8.3.10.0030.00619.04
8.3.00.0050.00319.63
8.2.180.0090.00916.75
8.2.170.0040.01222.96
8.2.160.0030.01321.30
8.2.150.0040.00424.18
8.2.140.0040.00424.66
8.2.130.0060.00326.16
8.2.120.0080.00021.02
8.2.110.0060.00322.44
8.2.100.0040.00818.33
8.2.90.0030.00617.99
8.2.80.0040.00418.00
8.2.70.0050.00318.13
8.2.60.0060.00318.17
8.2.50.0000.00818.16
8.2.40.0050.00720.34
8.2.30.0000.00818.14
8.2.20.0090.00018.03
8.2.10.0040.00418.14
8.2.00.0050.00318.17
8.1.280.0070.01125.92
8.1.270.0030.00524.66
8.1.260.0000.00826.35
8.1.250.0090.00028.09
8.1.240.0090.00021.03
8.1.230.0030.00919.14
8.1.220.0000.00817.91
8.1.210.0090.00018.77
8.1.200.0060.00317.50
8.1.190.0040.00417.48
8.1.180.0030.00618.10
8.1.170.0000.00918.84
8.1.160.0000.00819.03
8.1.150.0050.00318.88
8.1.140.0000.00917.78
8.1.130.0000.01017.89
8.1.120.0000.00817.73
8.1.110.0000.00817.79
8.1.100.0040.00417.76
8.1.90.0000.00817.64
8.1.80.0040.00417.79
8.1.70.0000.00717.71
8.1.60.0040.00417.71
8.1.50.0050.00317.68
8.1.40.0000.00817.76
8.1.30.0040.00417.82
8.1.20.0000.00817.86
8.1.10.0050.00317.73
8.1.00.0000.00817.68
8.0.300.0000.00819.90
8.0.290.0060.00316.88
8.0.280.0050.00218.55
8.0.270.0040.00417.43
8.0.260.0000.00717.23
8.0.250.0040.00417.36
8.0.240.0080.00017.19
8.0.230.0000.00817.31
8.0.220.0080.00017.18
8.0.210.0040.00317.13
8.0.200.0000.00717.23
8.0.190.0030.00517.26
8.0.180.0000.00817.16
8.0.170.0030.00617.15
8.0.160.0000.00717.28
8.0.150.0000.00917.23
8.0.140.0040.00417.18
8.0.130.0060.00013.68
8.0.120.0050.00317.07
8.0.110.0050.00317.07
8.0.100.0000.00717.11
8.0.90.0040.00417.08
8.0.80.0170.00017.30
8.0.70.0040.00417.09
8.0.60.0000.00917.26
8.0.50.0030.00517.22
8.0.30.0190.00017.39
8.0.20.0060.01517.25
8.0.10.0000.00817.43
8.0.00.0090.00917.00
7.4.330.0000.00513.18
7.4.320.0000.00716.72
7.4.300.0000.00716.63
7.4.290.0000.01116.74
7.4.280.0040.00416.79
7.4.270.0040.00416.80
7.4.260.0000.00613.46
7.4.250.0000.01016.76
7.4.240.0060.00216.66
7.4.230.0040.00416.53
7.4.220.0060.01316.65
7.4.210.0070.00816.81
7.4.200.0030.00316.61
7.4.190.0040.00416.67
7.4.160.0030.01316.78
7.4.150.0090.00916.87
7.4.140.0090.00916.56
7.4.130.0080.01116.94
7.4.120.0090.00916.74
7.4.110.0030.01416.72
7.4.100.0120.01316.87
7.4.90.0000.01916.80
7.4.80.0090.01419.39
7.4.70.0060.01116.78
7.4.60.0100.00716.62
7.4.50.0040.00416.85
7.4.40.0070.01016.65
7.4.30.0170.00016.91
7.4.00.0100.00915.17
7.3.330.0000.00713.67
7.3.320.0000.00513.54
7.3.310.0000.00716.53
7.3.300.0000.00716.72
7.3.290.0160.00016.70
7.3.280.0080.01016.66
7.3.270.0060.01316.93
7.3.260.0090.00916.61
7.3.250.0160.00316.63
7.3.240.0070.01016.82
7.3.230.0100.00716.64
7.3.210.0120.00616.59
7.3.200.0070.01616.78
7.3.190.0110.01116.71
7.3.180.0100.00616.86
7.3.170.0060.01216.80
7.3.160.0060.01016.73
7.3.120.0080.01015.24
7.3.110.0140.00615.10
7.3.100.0080.00814.87
7.3.90.0030.01014.86
7.3.80.0060.00715.01
7.3.70.0050.00615.15
7.3.60.0030.01715.02
7.3.50.0080.00515.07
7.3.40.0090.00515.02
7.3.30.0050.01215.12
7.3.20.0040.01316.73
7.3.10.0080.00616.78
7.3.00.0000.01616.81
7.2.330.0090.01216.89
7.2.320.0070.01016.75
7.2.310.0090.00916.86
7.2.300.0060.01016.78
7.2.290.0030.01416.93
7.2.250.0070.01015.27
7.2.240.0110.00815.28
7.2.230.0040.01115.21
7.2.220.0030.00915.11
7.2.210.0060.00815.43
7.2.200.0030.01215.22
7.2.190.0070.00615.22
7.2.180.0060.01115.23
7.2.170.0060.01015.01
7.2.00.0070.00719.64
7.1.330.0060.01015.93
7.1.320.0060.00816.05
7.1.310.0060.00815.85
7.1.300.0060.01115.88
7.1.290.0080.00516.07
7.1.280.0050.01115.92
7.1.270.0020.01315.92
7.1.260.0100.00716.01
7.1.200.0040.00415.74
7.1.100.0220.00617.99
7.1.70.0000.00817.40
7.1.60.0130.01319.40
7.1.50.0130.01317.17
7.1.00.0130.07022.31
7.0.200.0000.00716.83
7.0.140.0100.07022.05
7.0.120.0100.02721.98
7.0.100.0430.04319.87
7.0.90.0030.08319.88
7.0.80.0070.08319.86
7.0.70.0670.05019.96
7.0.60.0400.05319.95
7.0.50.0600.07320.38
7.0.40.0030.09019.95
7.0.30.0070.08320.05
7.0.20.0000.07720.13
7.0.10.0030.08020.04
7.0.00.0030.09020.04
5.6.280.0030.07721.05
5.6.250.0170.07320.59
5.6.240.0070.05720.54
5.6.230.0230.07720.47
5.6.220.0030.08320.61
5.6.210.0030.08020.61
5.6.200.0130.08320.93
5.6.190.0030.08021.07
5.6.180.0070.07020.92
5.6.170.0100.07021.05
5.6.160.0030.05320.98
5.6.150.0070.08021.13
5.6.140.0100.04021.01
5.6.130.0100.05021.04
5.6.120.0100.08321.00
5.6.110.0100.07320.91
5.6.100.0070.07021.09
5.6.90.0030.05021.03
5.6.80.0130.07320.37
5.6.70.0030.07320.45
5.6.60.0000.09320.30
5.6.50.0000.06020.40
5.6.40.0130.07020.43
5.6.30.0130.07320.43
5.6.20.0030.07720.36
5.6.10.0030.05020.35
5.6.00.0030.04320.38
5.5.380.0030.08320.36
5.5.370.0070.04720.33
5.5.360.0130.04020.30
5.5.350.0070.05020.39
5.5.340.0030.07320.85
5.5.330.0100.06320.61
5.5.320.0030.04720.80
5.5.310.0130.07320.65
5.5.300.0070.09020.84
5.5.290.0100.08020.74
5.5.280.0100.08720.79
5.5.270.0130.08720.72
5.5.260.0070.09020.79
5.5.250.0070.08020.61
5.5.240.0030.07320.11
5.5.230.0170.07319.98
5.5.220.0030.08320.21
5.5.210.0070.07320.26
5.5.200.0030.07720.19
5.5.190.0100.05320.15
5.5.180.0070.08320.18
5.5.160.0070.06720.05
5.5.150.0070.07720.19
5.5.140.0170.06720.20
5.5.130.0000.05320.20
5.5.120.0100.07720.04
5.5.110.0000.06020.20
5.5.100.0070.07020.02
5.5.90.0100.08020.05
5.5.80.0130.07720.12
5.5.70.0030.07720.00
5.5.60.0070.05720.10
5.5.50.0070.08320.02
5.5.40.0170.06720.05
5.5.30.0000.05019.96
5.5.20.0070.07719.87
5.5.10.0100.07719.92
5.5.00.0070.08019.96
5.4.450.0100.04719.17
5.4.440.0030.07719.22
5.4.430.0070.04719.40
5.4.420.0070.06319.44
5.4.410.0100.04019.40
5.4.400.0230.06019.18
5.4.390.0200.06318.94
5.4.380.0070.06019.09
5.4.370.0100.07019.17
5.4.360.0070.04019.20
5.4.350.0000.05019.22
5.4.340.0000.07718.90
5.4.320.0230.04718.88
5.4.310.0070.04319.05
5.4.300.0030.07719.02
5.4.290.0070.07718.84
5.4.280.0070.08319.13
5.4.270.0100.07719.17
5.4.260.0070.07319.12
5.4.250.0130.07719.04
5.4.240.0170.06719.03
5.4.230.0100.07719.20
5.4.220.0100.04318.84
5.4.210.0100.08018.86
5.4.200.0070.07318.98
5.4.190.0130.06719.15
5.4.180.0070.07719.11
5.4.170.0070.08319.11
5.4.160.0100.08019.01
5.4.150.0070.08019.18
5.4.140.0000.05016.41
5.4.130.0070.07316.40
5.4.120.0100.07316.34
5.4.110.0030.06716.37
5.4.100.0030.07316.58
5.4.90.0070.05016.54
5.4.80.0070.07016.54
5.4.70.0100.07316.46
5.4.60.0170.04016.45
5.4.50.0030.04316.32
5.4.40.0030.04716.29
5.4.30.0030.04316.30
5.4.20.0070.07316.42
5.4.10.0100.07316.30
5.4.00.0100.07315.80
5.3.290.0070.07314.74
5.3.280.0130.03714.59
5.3.270.0030.08314.70
5.3.260.0100.07314.72
5.3.250.0130.06314.64
5.3.240.0130.07314.73
5.3.230.0070.05714.63
5.3.220.0100.05714.53
5.3.210.0030.07314.58
5.3.200.0100.07314.60
5.3.190.0000.08014.63
5.3.180.0070.07014.54
5.3.170.0030.04014.54
5.3.160.0070.08014.64
5.3.150.0070.04314.64
5.3.140.0070.07314.64
5.3.130.0130.03714.68
5.3.120.0100.07714.52
5.3.110.0070.07314.50
5.3.100.0100.06714.18
5.3.90.0070.07713.98
5.3.80.0100.07314.10
5.3.70.0100.04714.10
5.3.60.0000.04014.08
5.3.50.0100.06714.03
5.3.40.0000.04714.03
5.3.30.0070.06313.82
5.3.20.0130.06713.83
5.3.10.0130.07013.77
5.3.00.0100.06013.78
5.2.170.0070.06711.23
5.2.160.0030.06311.18
5.2.150.0130.05011.29
5.2.140.0070.05011.02
5.2.130.0070.05311.03
5.2.120.0070.06311.14
5.2.110.0100.05711.04
5.2.100.0000.04310.99
5.2.90.0100.04711.16
5.2.80.0070.05311.04
5.2.70.0070.06011.26
5.2.60.0100.05711.19
5.2.50.0000.04311.16
5.2.40.0000.06711.05
5.2.30.0030.03311.06
5.2.20.0030.06311.12
5.2.10.0070.05310.97
5.2.00.0030.04710.69
5.1.60.0030.02710.12
5.1.50.0070.0309.90
5.1.40.0030.0539.89
5.1.30.0100.03310.48
5.1.20.0100.04010.50
5.1.10.0000.03710.18
5.1.00.0070.05010.10
5.0.50.0030.0478.66
5.0.40.0030.0478.55
5.0.30.0000.0638.35
5.0.20.0030.0378.29
5.0.10.0070.0408.29
5.0.00.0030.0338.18
4.4.90.0000.0375.96
4.4.80.0000.0275.96
4.4.70.0000.0375.96
4.4.60.0000.0305.96
4.4.50.0000.0375.96
4.4.40.0000.0505.96
4.4.30.0000.0475.96
4.4.20.0000.0305.96
4.4.10.0030.0375.96
4.4.00.0000.0575.96
4.3.110.0030.0375.96
4.3.100.0070.0305.96
4.3.90.0070.0175.96
4.3.80.0070.0435.96
4.3.70.0000.0235.96
4.3.60.0030.0305.96
4.3.50.0000.0335.96
4.3.40.0000.0435.96
4.3.30.0000.0335.96
4.3.20.0000.0335.96
4.3.10.0000.0305.96
4.3.00.0000.0335.96

preferences:
33.31 ms | 401 KiB | 5 Q