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; $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.60.0120.00316.88
8.3.50.0150.00622.08
8.3.40.0060.00918.96
8.3.30.0110.00319.21
8.3.20.0000.00820.16
8.3.10.0060.00321.89
8.3.00.0040.00419.26
8.2.180.0110.00718.54
8.2.170.0120.00922.96
8.2.160.0120.00920.38
8.2.150.0040.00424.18
8.2.140.0080.00024.66
8.2.130.0040.00426.16
8.2.120.0040.00422.17
8.2.110.0060.00322.21
8.2.100.0060.00619.70
8.2.90.0000.00819.21
8.2.80.0060.00317.97
8.2.70.0060.00317.88
8.2.60.0000.00818.03
8.2.50.0030.00618.07
8.2.40.0000.00820.07
8.2.30.0050.00518.18
8.2.20.0050.00318.00
8.2.10.0080.00018.02
8.2.00.0050.00318.04
8.1.280.0150.00625.92
8.1.270.0040.00423.71
8.1.260.0090.00026.35
8.1.250.0040.00428.09
8.1.240.0000.00923.74
8.1.230.0080.00419.09
8.1.220.0000.00917.74
8.1.210.0000.00818.77
8.1.200.0090.00017.60
8.1.190.0040.00417.48
8.1.180.0040.00418.10
8.1.170.0040.00418.71
8.1.160.0000.00722.02
8.1.150.0060.00318.87
8.1.140.0030.00517.61
8.1.130.0000.00817.84
8.1.120.0040.00417.70
8.1.110.0030.00617.66
8.1.100.0040.00817.63
8.1.90.0000.00817.61
8.1.80.0040.00417.64
8.1.70.0070.00017.61
8.1.60.0060.00317.57
8.1.50.0000.00817.49
8.1.40.0070.00217.57
8.1.30.0080.00017.62
8.1.20.0030.00517.66
8.1.10.0030.00617.69
8.1.00.0060.00317.66
8.0.300.0080.00018.77
8.0.290.0040.00417.18
8.0.280.0000.00818.49
8.0.270.0000.00817.28
8.0.260.0030.00318.47
8.0.250.0070.00017.18
8.0.240.0080.00017.06
8.0.230.0030.00317.16
8.0.220.0020.00517.14
8.0.210.0070.00017.10
8.0.200.0060.00417.16
8.0.190.0060.00317.05
8.0.180.0050.00316.96
8.0.170.0080.00017.02
8.0.160.0020.00517.07
8.0.150.0000.00816.89
8.0.140.0040.00416.95
8.0.130.0030.00313.46
8.0.120.0040.00417.12
8.0.110.0040.00417.04
8.0.100.0060.00316.90
8.0.90.0060.00317.00
8.0.80.0030.01317.05
8.0.70.0030.00516.94
8.0.60.0000.00816.93
8.0.50.0000.00817.16
8.0.30.0110.00817.21
8.0.20.0120.00817.40
8.0.10.0000.00817.34
8.0.00.0080.01416.97
7.4.330.0030.00315.14
7.4.320.0000.00716.74
7.4.300.0030.00516.64
7.4.290.0000.00816.61
7.4.280.0000.00816.59
7.4.270.0040.00416.68
7.4.260.0040.00416.67
7.4.250.0040.00416.50
7.4.240.0020.00616.52
7.4.230.0040.00416.69
7.4.220.0130.00616.73
7.4.210.0070.01016.74
7.4.200.0000.00816.72
7.4.190.0000.00916.82
7.4.160.0040.01216.55
7.4.150.0100.01017.40
7.4.140.0080.00917.86
7.4.130.0080.01016.60
7.4.120.0060.01216.67
7.4.110.0140.00716.56
7.4.100.0120.01216.77
7.4.90.0070.01016.61
7.4.80.0110.00819.39
7.4.70.0200.02616.85
7.4.60.0100.00716.71
7.4.50.0080.00016.53
7.4.40.0040.01316.68
7.4.30.0080.00816.75
7.4.00.0040.00714.99
7.3.330.0050.00313.36
7.3.320.0050.00013.56
7.3.310.0050.00216.66
7.3.300.0070.00016.47
7.3.290.0100.01016.57
7.3.280.0110.01016.54
7.3.270.0140.00317.40
7.3.260.0040.01416.68
7.3.250.0070.01416.56
7.3.240.0090.00916.55
7.3.230.0060.01216.61
7.3.210.0120.00616.45
7.3.200.0060.02019.39
7.3.190.0090.00916.66
7.3.180.0140.00316.68
7.3.170.0170.00016.66
7.3.160.0120.00316.49
7.3.120.0080.00315.10
7.2.330.0130.01316.64
7.2.320.0090.00916.86
7.2.310.0070.01116.71
7.2.300.0180.00316.86
7.2.290.0090.01116.98
7.2.60.0060.01016.96
7.2.00.0030.01019.57
7.1.200.0060.00615.76
7.1.100.0000.01017.91
7.1.70.0040.00417.36
7.1.60.0170.01019.46
7.1.50.0000.01817.08
7.1.00.0070.07322.57
7.0.200.0040.00416.82
7.0.140.0000.07322.15
7.0.100.0200.07719.96
7.0.90.0070.06019.97
7.0.80.0100.06719.93
7.0.70.0030.07319.89
7.0.60.0070.08319.98
7.0.50.0070.04320.36
7.0.40.0000.04720.07
7.0.30.0070.04020.13
7.0.20.0000.04719.96
7.0.10.0030.06020.04
7.0.00.0030.04320.12
5.6.280.0070.07321.09
5.6.250.0130.07720.77
5.6.240.0070.09020.65
5.6.230.0070.08320.55
5.6.220.0100.05020.71
5.6.210.0170.03720.66
5.6.200.0070.04721.11
5.6.190.0030.04320.96
5.6.180.0000.04721.00
5.6.170.0000.05021.18
5.6.160.0030.05321.03
5.6.150.0130.05321.18
5.6.140.0130.05320.95
5.6.130.0170.07021.03
5.6.120.0070.06320.94
5.6.110.0030.08721.08
5.6.100.0100.05021.11
5.6.90.0130.08021.05
5.6.80.0070.07720.50
5.6.70.0030.04020.39
5.6.60.0000.05320.42
5.6.50.0030.04020.57
5.6.40.0100.03320.39
5.6.30.0030.04020.44
5.6.20.0030.04020.39
5.6.10.0100.04320.37
5.6.00.0000.04720.35
5.5.380.0070.07720.37
5.5.370.0100.05020.36
5.5.360.0070.06020.37
5.5.350.0130.08320.47
5.5.340.0070.04320.83
5.5.330.0030.04320.79
5.5.320.0030.04720.78
5.5.310.0070.04020.88
5.5.300.0070.08320.86
5.5.290.0030.04720.79
5.5.280.0030.04020.89
5.5.270.0130.04320.89
5.5.260.0100.03720.86
5.5.250.0000.05720.46
5.5.240.0030.04020.20
5.5.230.0070.03720.21
5.5.220.0070.03720.24
5.5.210.0070.04720.32
5.5.200.0030.04020.23
5.5.190.0070.03720.23
5.5.180.0000.04320.16
5.5.160.0030.03320.12
5.5.150.0030.06320.19
5.5.140.0030.04320.26
5.5.130.0070.03320.27
5.5.120.0130.02720.11
5.5.110.0030.04319.97
5.5.100.0030.04319.96
5.5.90.0030.04720.16
5.5.80.0070.03719.95
5.5.70.0130.03020.07
5.5.60.0030.07720.06
5.5.50.0130.06720.07
5.5.40.0030.07020.14
5.5.30.0070.07319.98
5.5.20.0100.05020.04
5.5.10.0200.06020.12
5.5.00.0200.07020.12
5.4.450.0000.04719.51
5.4.440.0100.05719.37
5.4.430.0100.05319.37
5.4.420.0030.05719.44
5.4.410.0100.07019.24
5.4.400.0100.04319.13
5.4.390.0030.04318.95
5.4.380.0070.03319.23
5.4.370.0000.04019.18
5.4.360.0030.03719.13
5.4.350.0030.03719.14
5.4.340.0030.05719.18
5.4.320.0100.03719.16
5.4.310.0030.03719.13
5.4.300.0100.03719.12
5.4.290.0030.04319.04
5.4.280.0030.06719.16
5.4.270.0000.04018.88
5.4.260.0000.04319.20
5.4.250.0000.04318.90
5.4.240.0070.03319.13
5.4.230.0070.04319.09
5.4.220.0070.03319.08
5.4.210.0000.08019.23
5.4.200.0130.06719.22
5.4.190.0030.05318.88
5.4.180.0130.06019.02
5.4.170.0070.06019.22
5.4.160.0100.07319.01
5.4.150.0100.07019.11
5.4.140.0100.06316.42
5.4.130.0070.06016.45
5.4.120.0100.07016.19
5.4.110.0030.06316.36
5.4.100.0070.04316.36
5.4.90.0070.05716.52
5.4.80.0000.04716.47
5.4.70.0130.06316.46
5.4.60.0030.07016.48
5.4.50.0070.04716.46
5.4.40.0070.07716.32
5.4.30.0030.05716.32
5.4.20.0070.07316.44
5.4.10.0130.06016.48
5.4.00.0070.08016.00
5.3.290.0070.03714.70
5.3.280.0100.07314.75
5.3.270.0070.07014.55
5.3.260.0130.07714.68
5.3.250.0170.06314.74
5.3.240.0130.07014.67
5.3.230.0130.06014.75
5.3.220.0070.07314.72
5.3.210.0030.05014.61
5.3.200.0030.05714.55
5.3.190.0070.08314.51
5.3.180.0100.07014.64
5.3.170.0030.04714.60
5.3.160.0130.07314.70
5.3.150.0070.06714.60
5.3.140.0070.04014.66
5.3.130.0070.07314.67
5.3.120.0100.07314.50
5.3.110.0100.07014.63
5.3.100.0030.07314.05
5.3.90.0030.08014.06
5.3.80.0070.04314.15
5.3.70.0130.06713.96
5.3.60.0200.06014.04
5.3.50.0130.06013.96
5.3.40.0100.06713.86
5.3.30.0130.06713.98
5.3.20.0030.08313.69
5.3.10.0170.06713.72
5.3.00.0070.07313.74
5.2.170.0070.06311.63
5.2.160.0070.06011.63
5.2.150.0100.05711.63
5.2.140.0030.03011.63
5.2.130.0030.05011.63
5.2.120.0000.06011.63
5.2.110.0030.06711.63
5.2.100.0030.04711.63
5.2.90.0000.06711.63
5.2.80.0030.06311.63
5.2.70.0030.03011.63
5.2.60.0130.05711.63
5.2.50.0100.03011.63
5.2.40.0030.05311.63
5.2.30.0070.06011.63
5.2.20.0030.03311.63
5.2.10.0030.06011.63
5.2.00.0070.05711.63
5.1.60.0070.04011.63
5.1.50.0070.03011.63
5.1.40.0070.05011.63
5.1.30.0030.04711.63
5.1.20.0070.05311.63
5.1.10.0030.03011.63
5.1.00.0070.05711.63
5.0.50.0030.05311.63
5.0.40.0000.02711.63
5.0.30.0070.05311.63
5.0.20.0000.03711.63
5.0.10.0070.04311.63
5.0.00.0070.06011.63
4.4.90.0000.03311.63
4.4.80.0030.03711.63
4.4.70.0030.03711.63
4.4.60.0030.02011.63
4.4.50.0000.04011.63
4.4.40.0070.05011.63
4.4.30.0030.01311.63
4.4.20.0070.02311.63
4.4.10.0000.02311.63
4.4.00.0000.05711.63
4.3.110.0000.03711.63
4.3.100.0030.02311.63
4.3.90.0030.03311.63
4.3.80.0100.04311.63
4.3.70.0030.02311.63
4.3.60.0030.03311.63
4.3.50.0030.02011.63
4.3.40.0030.03011.63
4.3.30.0000.03311.63
4.3.20.0000.03711.63
4.3.10.0070.03311.63
4.3.00.0000.03011.63

preferences:
46.04 ms | 401 KiB | 5 Q