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"; $interval = dateDiff(strtotime($str1), strtotime($str2)); echo "difference " . $interval->y . " years, " . $inter-val>m . " months, " . $interval->d . " 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.70.0040.01418.68
8.3.60.0040.01118.77
8.3.50.0090.01218.35
8.3.40.0090.00619.18
8.3.30.0080.00818.96
8.3.20.0090.00018.94
8.3.10.0030.00618.82
8.3.00.0080.00019.50
8.2.180.0120.00318.66
8.2.170.0040.01122.96
8.2.160.0100.00719.09
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0050.00326.16
8.2.120.0040.00419.66
8.2.110.0050.00520.98
8.2.100.0040.00817.86
8.2.90.0030.00618.00
8.2.80.0030.00517.97
8.2.70.0000.00918.16
8.2.60.0000.00818.22
8.2.50.0050.00318.10
8.2.40.0030.00619.35
8.2.30.0060.00319.28
8.2.20.0070.00317.81
8.2.10.0040.00417.94
8.2.00.0060.00317.88
8.1.280.0180.00425.92
8.1.270.0040.00423.99
8.1.260.0090.00026.35
8.1.250.0040.00428.09
8.1.240.0060.00323.98
8.1.230.0040.00819.67
8.1.220.0000.00917.77
8.1.210.0000.00818.77
8.1.200.0150.00017.38
8.1.190.0040.00417.35
8.1.180.0000.00818.10
8.1.170.0060.00318.78
8.1.160.0000.00718.91
8.1.150.0040.00418.91
8.1.140.0040.00417.56
8.1.130.0000.00717.64
8.1.120.0000.00817.60
8.1.110.0000.00817.52
8.1.100.0000.00817.62
8.1.90.0040.00417.54
8.1.80.0040.00417.52
8.1.70.0000.00817.64
8.1.60.0000.00817.52
8.1.50.0040.00417.55
8.1.40.0030.00617.47
8.1.30.0000.00817.58
8.1.20.0000.01017.75
8.1.10.0040.00417.56
8.1.00.0000.01017.63
8.0.300.0080.00018.77
8.0.290.0030.00616.74
8.0.280.0040.00418.34
8.0.270.0040.00417.19
8.0.260.0090.00317.08
8.0.250.0000.01117.20
8.0.240.0030.00717.06
8.0.230.0030.00617.05
8.0.220.0050.00316.97
8.0.210.0020.00517.12
8.0.200.0000.00717.15
8.0.190.0040.00417.21
8.0.180.0060.00317.14
8.0.170.0090.00017.05
8.0.160.0000.00717.17
8.0.150.0030.00517.03
8.0.140.0040.00416.94
8.0.130.0060.00013.54
8.0.120.0030.00516.95
8.0.110.0040.00417.09
8.0.100.0050.00317.09
8.0.90.0040.00417.12
8.0.80.0040.01117.06
8.0.70.0030.00517.22
8.0.60.0000.00917.07
8.0.50.0000.00817.00
8.0.30.0090.00617.32
8.0.20.0120.00817.18
8.0.10.0000.00717.19
8.0.00.0100.00716.85
7.4.330.0050.00013.14
7.4.320.0070.00016.71
7.4.300.0000.00716.66
7.4.290.0090.00316.52
7.4.280.0000.00816.70
7.4.270.0000.01016.70
7.4.260.0030.00313.38
7.4.250.0030.00616.67
7.4.240.0040.00416.68
7.4.230.0050.00216.41
7.4.220.0040.01416.65
7.4.210.0070.01116.64
7.4.200.0040.00416.44
7.4.190.0000.00816.47
7.4.160.0100.00716.68
7.4.150.0150.00316.69
7.4.140.0110.00917.86
7.4.130.0090.00916.61
7.4.120.0120.00616.78
7.4.110.0050.01816.58
7.4.100.0120.00616.65
7.4.90.0100.00916.85
7.4.80.0120.00619.39
7.4.70.0040.01816.69
7.4.60.0100.00616.65
7.4.50.0000.00616.49
7.4.40.0070.00716.73
7.4.30.0040.01316.77
7.4.00.0030.01215.16
7.3.330.0030.00313.61
7.3.320.0070.00013.52
7.3.310.0030.00316.59
7.3.300.0040.00416.63
7.3.290.0080.01016.56
7.3.280.0190.00316.50
7.3.270.0110.00616.51
7.3.260.0060.01516.57
7.3.240.0100.00716.56
7.3.230.0110.00616.45
7.3.210.0060.01216.59
7.3.200.0110.00816.66
7.3.190.0030.01316.71
7.3.180.0080.00816.58
7.3.170.0060.01616.83
7.3.160.0150.00316.65
7.3.120.0100.00615.11
7.3.110.0100.01014.67
7.3.100.0100.00614.96
7.3.90.0000.01014.93
7.3.80.0030.01014.92
7.3.70.0050.00514.80
7.3.60.0060.00614.79
7.3.50.0000.01515.14
7.3.40.0070.00714.97
7.3.30.0030.00715.10
7.3.20.0030.01216.92
7.3.10.0090.00316.87
7.3.00.0000.01316.66
7.2.330.0090.00916.76
7.2.320.0140.00616.62
7.2.310.0030.02016.90
7.2.300.0090.00916.64
7.2.290.0120.00616.56
7.2.250.0090.01214.95
7.2.240.0060.01215.13
7.2.230.0070.01315.46
7.2.220.0000.01315.30
7.2.210.0060.01215.51
7.2.200.0110.00715.13
7.2.190.0080.00615.09
7.2.180.0070.01015.32
7.2.170.0030.00615.27
7.2.60.0060.00617.12
7.1.330.0120.00315.96
7.1.320.0000.01516.04
7.1.310.0050.00516.03
7.1.300.0070.00415.99
7.1.290.0030.00715.70
7.1.280.0090.00915.77
7.1.270.0000.01716.05
7.1.260.0030.00615.87
7.1.200.0000.00815.70
7.1.70.0040.00417.28
7.1.60.0070.01719.25
7.1.50.0150.00934.93
7.1.00.0030.03322.27
7.0.200.0000.00717.07
7.0.140.0170.06021.96
7.0.120.0070.06322.13
7.0.80.0430.05320.05
7.0.70.0600.07319.89
7.0.60.0430.05719.97
7.0.50.0570.08020.41
7.0.40.0030.04320.14
7.0.30.0070.09020.04
7.0.20.0070.04320.13
7.0.10.0130.08320.18
7.0.00.0130.08020.02
5.6.280.0030.07020.83
5.6.230.0170.04320.70
5.6.220.0070.04720.63
5.6.210.0070.04320.69
5.6.200.0070.08720.95
5.6.190.0030.08321.04
5.6.180.0100.07721.04
5.6.170.0100.08021.14
5.6.160.0030.08021.01
5.6.150.0030.05021.11
5.6.140.0070.09021.04
5.6.130.0070.06321.03
5.6.120.0030.08721.03
5.6.110.0100.06020.94
5.6.100.0130.08021.02
5.6.90.0130.05021.11
5.6.80.0200.06320.55
5.6.70.0100.07320.48
5.6.60.0170.07320.49
5.6.50.0070.05020.50
5.6.40.0070.08320.43
5.6.30.0100.05720.32
5.6.20.0070.04720.48
5.6.10.0070.04320.48
5.6.00.0130.07320.29
5.5.370.0000.07320.43
5.5.360.0070.04720.57
5.5.350.0070.04720.43
5.5.340.0170.07320.84
5.5.330.0070.04720.90
5.5.320.0070.08320.88
5.5.310.0030.06720.77
5.5.300.0100.06720.89
5.5.290.0100.06720.90
5.5.280.0070.06720.93
5.5.270.0100.03720.85
5.5.260.0070.08320.79
5.5.250.0130.07720.70
5.5.240.0030.08320.20
5.5.230.0070.05320.29
5.5.220.0070.04320.16
5.5.210.0030.08720.14
5.5.200.0130.06720.15
5.5.190.0100.07320.19
5.5.180.0070.07320.22
5.5.160.0130.04720.25
5.5.150.0130.05020.14
5.5.140.0130.06720.16
5.5.130.0000.08020.20
5.5.120.0070.08020.19
5.5.110.0030.05720.27
5.5.100.0070.04720.18
5.5.90.0100.07720.08
5.5.80.0100.05320.14
5.5.70.0070.07720.15
5.5.60.0030.04720.07
5.5.50.0070.08020.10
5.5.40.0100.07320.17
5.5.30.0170.06320.06
5.5.20.0100.07720.01
5.5.10.0100.07720.03
5.5.00.0100.07320.14
5.4.450.0070.08719.37
5.4.440.0170.07019.48
5.4.430.0100.06719.36
5.4.420.0030.08019.55
5.4.410.0170.06719.14
5.4.400.0170.05019.13
5.4.390.0100.08018.90
5.4.380.0030.04719.05
5.4.370.0100.04719.19
5.4.360.0130.05319.04
5.4.350.0100.03719.09
5.4.340.0030.08018.95
5.4.320.0030.08719.13
5.4.310.0100.07019.05
5.4.300.0130.06719.18
5.4.290.0070.07318.90
5.4.280.0030.08318.84
5.4.270.0100.07719.16
5.4.260.0030.07318.88
5.4.250.0130.06719.16
5.4.240.0100.07319.01
5.4.230.0100.06319.07
5.4.220.0030.07318.89
5.4.210.0000.04319.23
5.4.200.0070.06019.04
5.4.190.0100.07319.02
5.4.180.0130.06719.03
5.4.170.0100.05019.11
5.4.160.0070.07319.07
5.4.150.0070.05019.07
5.4.140.0100.04016.41
5.4.130.0070.04716.41
5.4.120.0170.06716.41
5.4.110.0100.06016.30
5.4.100.0100.07016.43
5.4.90.0000.05316.43
5.4.80.0130.06016.48
5.4.70.0070.04016.49
5.4.60.0000.08316.45
5.4.50.0070.04316.47
5.4.40.0070.03716.43
5.4.30.0030.05716.24
5.4.20.0030.04716.47
5.4.10.0030.04716.40
5.4.00.0030.05015.89
5.3.290.0030.08314.80
5.3.280.0100.07714.55
5.3.270.0030.07714.76
5.3.260.0100.07314.69
5.3.250.0030.04714.73
5.3.240.0100.07314.63
5.3.230.0030.05314.68
5.3.220.0100.07314.55
5.3.210.0200.04014.64
5.3.200.0070.05014.59
5.3.190.0030.05314.70
5.3.180.0070.04014.57
5.3.170.0130.03314.56
5.3.160.0100.07314.61
5.3.150.0030.08014.67
5.3.140.0070.03714.51
5.3.130.0030.07314.49
5.3.120.0070.04714.53
5.3.110.0070.08014.70
5.3.100.0100.07714.02
5.3.90.0030.05014.05
5.3.80.0030.07313.93
5.3.70.0000.04313.95
5.3.60.0000.04014.13
5.3.50.0030.07714.07
5.3.40.0070.05313.94
5.3.30.0070.07313.99
5.3.20.0070.07013.84
5.3.10.0200.03013.67
5.3.00.0000.04013.58
5.2.170.0000.05011.05
5.2.160.0000.05311.04
5.2.150.0000.03711.22
5.2.140.0070.04011.16
5.2.130.0030.04011.00
5.2.120.0130.02011.12
5.2.110.0070.03011.18
5.2.100.0070.06311.02
5.2.90.0070.06311.18
5.2.80.0000.05710.97
5.2.70.0000.07011.25
5.2.60.0030.04311.12
5.2.50.0070.04011.09
5.2.40.0130.02710.90
5.2.30.0070.04710.90
5.2.20.0030.04710.85
5.2.10.0030.04010.93
5.2.00.0030.03710.84
5.1.60.0000.02710.00
5.1.50.0130.02010.10
5.1.40.0030.03710.03
5.1.30.0000.03010.42
5.1.20.0030.03010.36
5.1.10.0000.0339.97
5.1.00.0070.05710.07
5.0.50.0030.0208.63
5.0.40.0000.0178.54
5.0.30.0000.0308.36
5.0.20.0000.0338.30
5.0.10.0000.0208.20
5.0.00.0000.0308.28
4.4.90.0030.0307.36
4.4.80.0000.0307.36
4.4.70.0000.0207.36
4.4.60.0000.0177.36
4.4.50.0000.0307.36
4.4.40.0000.0377.36
4.4.30.0030.0137.36
4.4.20.0000.0237.36
4.4.10.0000.0177.36
4.4.00.0070.0207.36
4.3.110.0000.0137.36
4.3.100.0000.0137.36
4.3.90.0000.0137.36
4.3.80.0000.0237.36
4.3.70.0030.0137.36
4.3.60.0000.0137.36
4.3.50.0000.0177.36
4.3.40.0000.0407.36
4.3.30.0000.0337.36
4.3.20.0030.0137.36
4.3.10.0000.0137.36
4.3.00.0000.0137.36

preferences:
47.6 ms | 401 KiB | 5 Q