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 { 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; $mydate = dateDiff(strtotime($str1), strtotime($str2)); $string = "difference " . $mydate->y . " years, " . $mydate->m . " months, " . $mydate->d . " days"; echo $string; $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.0130.00318.53
8.3.50.0120.00718.22
8.3.40.0060.01219.00
8.3.30.0120.00418.83
8.3.20.0040.00419.02
8.3.10.0040.00419.03
8.3.00.0040.00419.63
8.2.180.0120.00316.75
8.2.170.0120.00322.96
8.2.160.0100.00719.01
8.2.150.0080.00024.18
8.2.140.0040.00424.66
8.2.130.0040.00426.16
8.2.120.0040.00419.80
8.2.110.0090.00022.10
8.2.100.0090.00319.79
8.2.90.0060.00317.74
8.2.80.0030.00619.07
8.2.70.0040.00417.75
8.2.60.0090.00018.04
8.2.50.0040.00818.07
8.2.40.0060.00318.22
8.2.30.0090.00017.98
8.2.20.0070.00417.95
8.2.10.0040.00717.99
8.2.00.0060.00317.92
8.1.280.0120.00625.92
8.1.270.0040.00423.99
8.1.260.0040.00426.35
8.1.250.0040.00428.09
8.1.240.0100.00020.72
8.1.230.0070.00417.86
8.1.220.0050.00317.74
8.1.210.0000.00818.77
8.1.200.0040.00417.48
8.1.190.0050.00317.35
8.1.180.0070.00318.10
8.1.170.0040.00418.71
8.1.160.0040.00419.12
8.1.150.0040.00418.83
8.1.140.0000.00817.67
8.1.130.0080.00019.35
8.1.120.0040.00417.64
8.1.110.0000.00717.53
8.1.100.0040.00417.61
8.1.90.0050.00317.64
8.1.80.0060.00317.56
8.1.70.0000.00817.59
8.1.60.0030.00617.59
8.1.50.0060.00317.67
8.1.40.0030.00617.70
8.1.30.0030.00617.66
8.1.20.0030.00917.66
8.1.10.0030.00517.73
8.1.00.0030.00617.48
8.0.300.0030.00618.96
8.0.290.0000.00817.00
8.0.280.0070.00018.35
8.0.270.0000.00717.31
8.0.260.0030.00316.95
8.0.250.0030.00617.07
8.0.240.0040.00417.08
8.0.230.0030.00617.20
8.0.220.0080.00017.06
8.0.210.0050.00217.02
8.0.200.0040.00417.23
8.0.190.0040.00417.22
8.0.180.0040.00417.24
8.0.170.0060.00317.16
8.0.160.0040.00417.05
8.0.150.0060.00317.07
8.0.140.0050.00217.00
8.0.130.0030.00313.57
8.0.120.0060.00617.18
8.0.110.0040.00417.18
8.0.100.0040.00416.99
8.0.90.0000.00717.18
8.0.80.0090.01417.09
8.0.70.0000.00816.91
8.0.60.0030.00617.16
8.0.50.0000.00917.16
8.0.30.0090.00917.26
8.0.20.0080.01217.41
8.0.10.0000.00817.22
8.0.00.0130.01016.86
7.4.330.0000.00513.16
7.4.320.0060.00316.74
7.4.300.0000.00716.51
7.4.290.0000.00916.65
7.4.280.0040.00416.62
7.4.270.0000.00816.53
7.4.260.0060.00013.41
7.4.250.0000.00816.59
7.4.240.0000.00716.64
7.4.230.0000.00816.80
7.4.220.0190.00316.60
7.4.210.0070.01416.68
7.4.200.0070.00016.52
7.4.190.0060.00316.68
7.4.160.0060.01116.71
7.4.150.0080.01216.48
7.4.140.0110.00817.86
7.4.130.0110.00916.83
7.4.120.0100.01416.83
7.4.110.0130.01316.68
7.4.100.0100.00716.69
7.4.90.0140.00616.49
7.4.80.0060.01219.39
7.4.70.0060.01116.46
7.4.60.0120.00616.52
7.4.50.0000.00516.55
7.4.40.0060.01316.51
7.4.30.0080.00916.71
7.4.00.0090.00915.02
7.3.330.0040.00413.55
7.3.320.0040.00413.43
7.3.310.0000.00716.55
7.3.300.0070.00016.59
7.3.290.0120.01116.55
7.3.280.0150.00616.64
7.3.270.0130.00316.56
7.3.260.0180.00016.55
7.3.240.0040.01516.57
7.3.230.0090.00916.58
7.3.210.0060.01116.64
7.3.200.0070.01016.63
7.3.190.0160.00016.84
7.3.180.0060.01116.86
7.3.170.0090.00616.52
7.3.160.0100.00716.45
7.3.120.0090.00615.16
7.3.110.0040.01215.07
7.3.100.0070.00715.08
7.3.90.0050.00914.71
7.3.80.0000.00915.01
7.3.70.0030.01014.88
7.3.60.0080.00615.11
7.3.50.0000.01515.02
7.3.40.0080.00814.81
7.3.30.0060.00614.86
7.3.20.0070.01016.73
7.3.10.0090.00816.59
7.3.00.0070.00616.72
7.2.330.0100.01016.96
7.2.320.0160.00716.80
7.2.310.0040.02216.93
7.2.300.0100.00716.61
7.2.290.0070.01716.96
7.2.240.0110.00715.15
7.2.230.0030.01614.96
7.2.220.0080.00815.41
7.2.210.0060.00915.27
7.2.200.0070.00715.02
7.2.190.0030.01415.03
7.2.180.0040.01114.88
7.2.170.0000.00915.20
7.2.160.0000.01414.84
7.2.150.0000.01517.25
7.2.140.0060.00617.07
7.2.130.0140.00416.94
7.2.120.0030.01017.05
7.2.110.0060.00917.08
7.2.100.0080.00817.02
7.2.90.0070.00817.19
7.2.80.0060.00816.91
7.2.70.0080.00817.08
7.2.60.0060.01016.96
7.2.50.0090.00917.02
7.2.40.0090.00816.98
7.2.30.0080.00817.06
7.2.20.0030.01017.06
7.2.10.0080.00717.08
7.2.00.0060.00817.10
7.1.330.0100.00715.82
7.1.320.0070.01015.88
7.1.310.0080.00815.88
7.1.300.0070.00315.98
7.1.290.0000.01115.63
7.1.280.0000.01916.06
7.1.270.0100.00315.72
7.1.260.0120.00315.77
7.1.250.0060.00915.91
7.1.200.0070.00716.07
7.1.70.0050.00517.33
7.1.60.0100.01619.25
7.1.50.0180.00716.89
7.1.00.0030.03322.36
7.0.200.0000.00716.74
7.0.140.0070.07022.16
7.0.120.0000.07022.02
7.0.80.0330.07020.00
7.0.70.0500.08719.92
7.0.60.0100.07719.82
7.0.50.0070.08320.36
7.0.40.0100.05720.00
7.0.30.0000.05720.08
7.0.20.0100.04720.05
7.0.10.0100.08020.18
7.0.00.0100.07720.05
5.6.280.0030.07721.11
5.6.230.0100.08320.52
5.6.220.0070.06020.73
5.6.210.0130.08320.68
5.6.200.0070.05021.04
5.6.190.0030.08321.02
5.6.180.0070.07021.10
5.6.170.0170.05321.03
5.6.160.0170.07020.97
5.6.150.0100.06021.09
5.6.140.0070.08321.03
5.6.130.0130.08021.04
5.6.120.0070.07721.04
5.6.110.0070.09020.94
5.6.100.0130.08020.95
5.6.90.0170.04721.05
5.6.80.0100.04320.34
5.6.70.0030.05020.40
5.6.60.0000.09020.39
5.6.50.0130.07020.57
5.6.40.0030.08020.45
5.6.30.0030.04320.33
5.6.20.0030.08020.46
5.6.10.0030.09020.43
5.6.00.0070.07320.30
5.5.370.0100.04720.43
5.5.360.0130.08020.45
5.5.350.0100.08320.45
5.5.340.0100.04320.79
5.5.330.0100.05320.66
5.5.320.0070.05320.95
5.5.310.0070.06320.91
5.5.300.0070.08320.79
5.5.290.0070.07720.92
5.5.280.0070.06320.77
5.5.270.0130.08320.91
5.5.260.0130.04720.86
5.5.250.0130.07320.71
5.5.240.0100.07320.27
5.5.230.0070.04720.17
5.5.220.0030.06020.22
5.5.210.0030.05320.18
5.5.200.0030.05720.28
5.5.190.0200.06720.29
5.5.180.0030.05320.14
5.5.160.0030.05320.19
5.5.150.0100.07720.22
5.5.140.0000.05320.16
5.5.130.0070.08320.22
5.5.120.0070.08020.12
5.5.110.0130.07720.24
5.5.100.0100.03320.03
5.5.90.0030.05320.13
5.5.80.0100.07720.06
5.5.70.0030.04720.13
5.5.60.0000.08020.06
5.5.50.0070.05320.07
5.5.40.0100.07019.97
5.5.30.0070.07320.16
5.5.20.0000.08320.04
5.5.10.0170.06720.02
5.5.00.0070.08320.09
5.4.450.0070.07719.49
5.4.440.0000.05019.23
5.4.430.0130.07719.55
5.4.420.0170.07319.55
5.4.410.0070.07319.16
5.4.400.0070.07719.24
5.4.390.0100.07319.13
5.4.380.0130.07318.85
5.4.370.0130.06018.85
5.4.360.0070.08319.03
5.4.350.0000.08319.03
5.4.340.0170.06319.05
5.4.320.0130.04719.18
5.4.310.0100.06719.18
5.4.300.0030.04019.04
5.4.290.0000.05319.02
5.4.280.0130.03318.84
5.4.270.0130.06319.14
5.4.260.0030.04319.16
5.4.250.0030.08318.90
5.4.240.0070.05019.22
5.4.230.0030.08019.14
5.4.220.0070.05719.17
5.4.210.0100.04019.17
5.4.200.0030.04019.08
5.4.190.0100.04019.02
5.4.180.0070.07019.22
5.4.170.0100.07719.08
5.4.160.0130.07019.03
5.4.150.0100.07719.16
5.4.140.0000.06316.35
5.4.130.0100.06716.45
5.4.120.0030.07016.45
5.4.110.0070.07716.51
5.4.100.0070.07716.29
5.4.90.0070.07716.29
5.4.80.0200.06016.45
5.4.70.0100.07016.48
5.4.60.0030.05716.39
5.4.50.0030.07716.39
5.4.40.0070.07316.30
5.4.30.0170.06316.47
5.4.20.0100.07016.37
5.4.10.0070.04716.32
5.4.00.0000.08015.59
5.3.290.0030.04314.74
5.3.280.0100.07714.63
5.3.270.0130.03314.68
5.3.260.0000.05314.63
5.3.250.0070.04014.59
5.3.240.0100.07014.66
5.3.230.0030.04314.68
5.3.220.0070.07714.69
5.3.210.0030.08714.68
5.3.200.0070.08314.71
5.3.190.0070.05314.54
5.3.180.0270.03714.60
5.3.170.0100.04014.59
5.3.160.0170.05714.69
5.3.150.0070.08014.53
5.3.140.0100.07714.60
5.3.130.0030.06014.63
5.3.120.0030.08714.56
5.3.110.0100.07714.51
5.3.100.0100.06714.02
5.3.90.0030.07314.05
5.3.80.0030.05314.06
5.3.70.0030.04013.96
5.3.60.0070.06313.91
5.3.50.0030.04714.02
5.3.40.0000.06313.85
5.3.30.0030.07714.03
5.3.20.0070.07713.79
5.3.10.0030.04313.71
5.3.00.0130.06713.58
5.2.170.0030.06011.08
5.2.160.0100.06011.09
5.2.150.0130.05711.17
5.2.140.0070.04711.06
5.2.130.0030.06311.17
5.2.120.0030.03311.16
5.2.110.0030.04011.17
5.2.100.0070.06011.23
5.2.90.0030.06711.13
5.2.80.0070.06011.25
5.2.70.0000.05311.10
5.2.60.0070.06011.13
5.2.50.0000.06711.06
5.2.40.0030.06311.10
5.2.30.0030.06711.05
5.2.20.0100.04711.09
5.2.10.0130.04710.92
5.2.00.0070.03310.92
5.1.60.0070.05010.92
5.1.50.0000.04310.92
5.1.40.0000.04710.92
5.1.30.0070.04310.92
5.1.20.0070.06010.92
5.1.10.0130.04710.92
5.1.00.0030.05710.92
5.0.50.0130.03310.92
5.0.40.0130.03310.92
5.0.30.0070.05010.92
5.0.20.0000.04010.92
5.0.10.0030.04010.92
5.0.00.0070.06710.92
4.4.90.0000.02310.92
4.4.80.0070.03310.92
4.4.70.0000.02310.92
4.4.60.0000.04010.92
4.4.50.0030.02010.92
4.4.40.0030.03710.92
4.4.30.0030.03710.92
4.4.20.0000.03310.92
4.4.10.0000.04010.92
4.4.00.0030.05710.92
4.3.110.0000.03710.92
4.3.100.0070.03310.92
4.3.90.0070.02710.92
4.3.80.0030.05310.92
4.3.70.0030.02710.92
4.3.60.0030.03310.92
4.3.50.0070.03010.92
4.3.40.0070.03710.92
4.3.30.0000.03710.92
4.3.20.0030.03310.92
4.3.10.0030.03310.92
4.3.00.0000.02010.92

preferences:
44.99 ms | 401 KiB | 5 Q