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; $firsttemp = $first; $months = 0; $days = 0; while(TRUE) { if($firsttemp + 86400 * date('t', $firsttemp) <= $second) { $months += 1; $firsttemp += 86400 * date('t', $firsttemp); } else { if($second - $firsttemp >= 86400) { $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->y = $years; $dateObj->m = $months; $dateObj->d = $days; $dateObj->h = $hours; $dateObj->i = $minutes; $dateObj->s = $seconds; $dateObj->days = floor($inbetween / 86400); return $dateObj; } $str1 = "1970-01-01"; $str2 = "2009-01-01"; $tempdate1 = $str1; $n = 0; while(strtotime($tempdate1) <= strtotime($str2)) { $mydate = dateDiff(strtotime($str1), strtotime($tempdate1)); $string2 = "(" . $mydate->days . ") difference " . $mydate->y . " years, " . $mydate->m . " months, " . $mydate->d . " days, " . $mydate->h . " hours, " . $mydate->i . " minutes, and " . $mydate->s . " seconds"; echo "<span style=\"color:green;\">", $string1, " - ", $string2, "</span><br />"; $n += 321; $tempdate1 = $str1 . " +" . $n . " sec"; }

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.00917.00
8.3.50.0130.00918.54
8.3.40.0380.01918.95
8.3.30.0070.01018.80
8.3.20.0090.00019.02
8.3.10.0100.00318.94
8.3.00.0060.00319.52
8.2.180.0140.00717.00
8.2.170.0060.01322.96
8.2.160.0100.01019.21
8.2.150.0050.00524.18
8.2.140.0280.01424.66
8.2.130.0060.00326.16
8.2.120.0000.01019.81
8.2.110.0070.00319.35
8.2.100.0060.00618.34
8.2.90.0070.00319.51
8.2.80.0080.00318.00
8.2.70.0030.00617.86
8.2.60.0080.00418.28
8.2.50.0130.00417.93
8.2.40.0030.00719.98
8.2.30.0080.00318.21
8.2.20.0030.00918.09
8.2.10.0030.00618.29
8.2.00.0150.00018.24
8.1.280.0110.01525.92
8.1.270.0080.00523.99
8.1.260.0090.00026.35
8.1.250.0040.00428.09
8.1.240.0070.00421.30
8.1.230.0060.00617.96
8.1.220.0030.00617.90
8.1.210.0050.00518.77
8.1.200.0090.00317.73
8.1.190.0000.00917.60
8.1.180.0060.00318.10
8.1.170.0030.00717.72
8.1.160.0030.00519.31
8.1.150.0070.00719.07
8.1.140.0070.00417.79
8.1.130.0030.00619.65
8.1.120.0050.00517.84
8.1.110.0040.00817.77
8.1.100.0030.00617.70
8.1.90.0030.00517.88
8.1.80.0060.00317.79
8.1.70.0070.00317.89
8.1.60.0030.00617.82
8.1.50.0080.00817.90
8.1.40.0000.01017.84
8.1.30.0060.00517.93
8.1.20.0060.00617.85
8.1.10.0030.00617.86
8.1.00.0030.00917.93
8.0.300.0070.00318.96
8.0.290.0060.01117.13
8.0.280.0080.00818.74
8.0.270.0060.01117.43
8.0.260.0040.01217.19
8.0.250.0070.01117.32
8.0.240.0080.01517.30
8.0.230.0040.01317.21
8.0.220.0000.01617.09
8.0.210.0040.01317.22
8.0.200.0090.00417.28
8.0.190.0080.01317.32
8.0.180.0000.01017.30
8.0.170.0000.01117.20
8.0.160.0000.01717.20
8.0.150.0030.01017.05
8.0.140.0060.01217.12
8.0.130.0070.00313.72
8.0.120.0090.01217.24
8.0.110.0060.01117.18
8.0.100.0000.01217.23
8.0.90.0080.01217.15
8.0.80.0120.03217.25
8.0.70.0110.00717.05
8.0.60.0110.00817.05
8.0.50.0070.00717.09
8.0.30.0300.02617.52
8.0.20.0350.02617.40
8.0.10.0050.01017.44
8.0.00.0250.02217.00
7.4.330.0140.00013.29
7.4.320.0040.00816.77
7.4.300.0100.00616.73
7.4.290.0140.01116.75
7.4.280.0030.00916.66
7.4.270.0090.00916.77
7.4.260.0100.01013.46
7.4.250.0070.01516.75
7.4.240.0110.01116.77
7.4.230.0040.01116.66
7.4.220.0160.02816.63
7.4.210.0130.00916.71
7.4.200.0000.01616.62
7.4.190.0040.01216.65
7.4.160.0410.03316.75
7.4.150.0440.02116.95
7.4.140.0180.02117.86
7.4.130.0430.04116.71
7.4.120.0240.03016.99
7.4.110.0840.05116.82
7.4.100.0380.05117.02
7.4.90.1110.03516.75
7.4.80.0100.02019.39
7.4.70.0530.03516.74
7.4.60.0220.03016.83
7.4.50.0110.00416.74
7.4.40.0340.02816.77
7.4.30.0460.03316.60
7.4.00.0110.01814.75
7.3.330.0070.00313.78
7.3.320.0060.00613.64
7.3.310.0040.01416.59
7.3.300.0000.02016.65
7.3.290.0150.01916.59
7.3.280.0320.01616.48
7.3.270.0310.03116.77
7.3.260.0380.02216.67
7.3.240.0140.02716.70
7.3.230.0150.01916.55
7.3.210.0160.01016.76
7.3.200.0170.01716.66
7.3.190.0110.02516.59
7.3.180.0090.01316.62
7.3.170.0220.03716.77
7.3.160.0540.04916.55
7.3.120.0000.02215.10
7.2.330.0290.03616.60
7.2.320.0280.02316.79
7.2.310.0230.01717.01
7.2.300.0260.02817.00
7.2.290.0220.03916.80
7.2.00.0030.01719.51
7.1.100.0040.01218.35
7.1.70.0000.01217.34
7.1.60.0070.01719.25
7.1.50.0140.00717.18
7.1.00.0000.04322.24
7.0.200.0000.01416.91
7.0.140.0030.08022.01
7.0.120.0070.08022.18
7.0.100.0370.08019.97
7.0.90.0370.08020.01
7.0.80.0400.07019.96
7.0.70.0270.07020.00
7.0.60.0270.07320.03
7.0.50.0430.05320.39
7.0.40.0030.08720.15
7.0.30.0070.09720.07
7.0.20.0270.07320.19
7.0.10.0000.09320.13
7.0.00.0030.05020.10
5.6.280.0070.08720.92
5.6.250.0100.08020.59
5.6.240.0070.10020.70
5.6.230.0030.05720.70
5.6.220.0030.06020.70
5.6.210.0070.09020.58
5.6.200.0200.08321.07
5.6.190.0130.05021.04
5.6.180.0130.07721.11
5.6.170.0070.08721.09
5.6.160.0070.08321.20
5.6.150.0130.05021.07
5.6.140.0070.06321.12
5.6.130.0100.08721.12
5.6.120.0070.05721.11
5.6.110.0070.10021.18
5.6.100.0070.05721.05
5.6.90.0130.09321.02
5.6.80.0100.09720.46
5.6.70.0100.05720.43
5.6.60.0130.04020.35
5.6.50.0200.04020.37
5.6.40.0130.08320.45
5.6.30.0000.09020.48
5.6.20.0030.08020.32
5.6.10.0170.03720.29
5.6.00.0170.04020.41
5.5.380.0230.06020.43
5.5.370.0070.07720.58
5.5.360.0230.05320.43
5.5.350.0170.06020.43
5.5.340.0130.06720.70
5.5.330.0100.06320.82
5.5.320.0030.07320.88
5.5.310.0130.06720.88
5.5.300.0170.09720.98
5.5.290.0230.06020.82
5.5.280.0100.07320.88
5.5.270.0200.06320.94
5.5.260.0130.07320.89
5.5.250.0230.05720.69
5.5.240.0130.09020.30
5.5.230.0130.06320.37
5.5.220.0170.06320.29
5.5.210.0100.05720.38
5.5.200.0070.07020.21
5.5.190.0170.07320.35
5.5.180.0230.06020.33
5.5.160.0170.05320.34
5.5.150.0070.07020.34
5.5.140.0200.05020.29
5.5.130.0100.07720.18
5.5.120.0070.07020.29
5.5.110.0130.05720.29
5.5.100.0170.06720.17
5.5.90.0130.06020.05
5.5.80.0200.07020.19
5.5.70.0230.05720.13
5.5.60.0170.07320.14
5.5.50.0300.04720.23
5.5.40.0130.06020.02
5.5.30.0170.06020.18
5.5.20.0100.06020.09
5.5.10.0070.06320.07
5.5.00.0230.05320.05
5.4.450.0230.05719.41
5.4.440.0170.06019.39
5.4.430.0130.06719.36
5.4.420.0100.07019.39
5.4.410.0170.04719.29
5.4.400.0100.08319.08
5.4.390.0100.06718.98
5.4.380.0100.05719.12
5.4.370.0100.06719.12
5.4.360.0170.06319.07
5.4.350.0070.06719.07
5.4.340.0070.07318.90
5.4.320.0070.06319.07
5.4.310.0030.07018.97
5.4.300.0100.06318.89
5.4.290.0170.06019.07
5.4.280.0170.07019.06
5.4.270.0170.05718.87
5.4.260.0070.06719.06
5.4.250.0170.07018.91
5.4.240.0100.06319.04
5.4.230.0030.07019.06
5.4.220.0170.06019.08
5.4.210.0070.06719.02
5.4.200.0170.06018.86
5.4.190.0200.04719.02
5.4.180.0030.06019.06
5.4.170.0100.06318.85
5.4.160.0130.06019.05
5.4.150.0000.07318.84
5.4.140.0200.05316.49
5.4.130.0130.05716.41
5.4.120.0130.05716.47
5.4.110.0200.05716.49
5.4.100.0170.08016.31
5.4.90.0200.06016.50
5.4.80.0230.05016.48
5.4.70.0170.05716.26
5.4.60.0200.06016.26
5.4.50.0030.07016.33
5.4.40.0070.06316.26
5.4.30.0230.05016.54
5.4.20.0170.05316.46
5.4.10.0070.06716.29
5.4.00.0200.05315.93
5.3.290.0170.06014.58
5.3.280.0130.05014.60
5.3.270.0100.06314.45
5.3.260.0100.08714.44
5.3.250.0070.06714.48
5.3.240.0100.06714.44
5.3.230.0000.07014.47
5.3.220.0100.06714.41
5.3.210.0130.06014.47
5.3.200.0200.06014.29
5.3.190.0070.06714.46
5.3.180.0170.06714.45
5.3.170.0100.07314.43
5.3.160.0130.07014.42
5.3.150.0130.05314.45
5.3.140.0070.07314.55
5.3.130.0230.06714.43
5.3.120.0130.06014.38
5.3.110.0130.08714.38
5.3.100.0130.06313.87
5.3.90.0070.05713.92
5.3.80.0070.07013.81
5.3.70.0200.05013.84
5.3.60.0130.06713.84
5.3.50.0130.06013.77
5.3.40.0030.07013.70
5.3.30.0070.06313.64
5.3.20.0030.07013.36
5.3.10.0170.06313.48
5.3.00.0200.05313.45

preferences:
39.9 ms | 401 KiB | 5 Q