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 = $inbetween / 60 / 60 / 24; return $dateObj; } $str1 = "1970-01-01 + 21 sec"; $str2 = "2009-01-01 + 54061 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($tempdate1)); $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.0060.01218.33
8.3.50.0250.01016.48
8.3.40.0180.00018.69
8.3.30.0040.01118.94
8.3.20.0090.00018.85
8.3.10.0080.00018.84
8.3.00.0080.00019.38
8.2.180.0040.01216.75
8.2.170.0090.00622.96
8.2.160.0040.01118.91
8.2.150.0000.00824.18
8.2.140.0040.00424.66
8.2.130.0070.00026.16
8.2.120.0080.00019.66
8.2.110.0060.00321.03
8.2.100.0100.00319.76
8.2.90.0000.00919.70
8.2.80.0080.00018.05
8.2.70.0060.00318.05
8.2.60.0030.00518.22
8.2.50.0030.00618.10
8.2.40.0030.00519.28
8.2.30.0050.00518.02
8.2.20.0050.00517.82
8.2.10.0000.00918.09
8.2.00.0000.00718.04
8.1.280.0060.00925.92
8.1.270.0090.00023.99
8.1.260.0000.00726.35
8.1.250.0000.00728.09
8.1.240.0150.00017.57
8.1.230.0000.01120.97
8.1.220.0070.00417.79
8.1.210.0060.00319.03
8.1.200.0060.00317.60
8.1.190.0030.00617.60
8.1.180.0060.00318.10
8.1.170.0030.00518.76
8.1.160.0060.00318.89
8.1.150.0040.00418.86
8.1.140.0040.00417.63
8.1.130.0040.00417.58
8.1.120.0040.00417.62
8.1.110.0000.00917.74
8.1.100.0000.00717.57
8.1.90.0070.00017.51
8.1.80.0030.00317.59
8.1.70.0030.00317.61
8.1.60.0040.00417.79
8.1.50.0030.00617.67
8.1.40.0100.00017.69
8.1.30.0060.00317.80
8.1.20.0080.00317.74
8.1.10.0040.00417.78
8.1.00.0060.00317.70
8.0.300.0000.00819.89
8.0.290.0060.00316.88
8.0.280.0000.00718.16
8.0.270.0000.00717.40
8.0.260.0070.00017.15
8.0.250.0080.00017.25
8.0.240.0000.00717.15
8.0.230.0030.00617.26
8.0.220.0040.00417.10
8.0.210.0030.00317.20
8.0.200.0080.00017.27
8.0.190.0000.00717.12
8.0.180.0000.00717.19
8.0.170.0000.00817.20
8.0.160.0030.00517.27
8.0.150.0040.00417.16
8.0.140.0030.00517.09
8.0.130.0030.00313.58
8.0.120.0060.00317.19
8.0.110.0040.00417.24
8.0.100.0000.00717.07
8.0.90.0040.00417.17
8.0.80.0100.01017.06
8.0.70.0040.00417.24
8.0.60.0030.00617.16
8.0.50.0040.00417.21
8.0.30.0090.00917.41
8.0.20.0100.01117.25
8.0.10.0070.00017.29
8.0.00.0130.00417.10
7.4.330.0000.00513.24
7.4.320.0000.00716.66
7.4.300.0030.00316.74
7.4.290.0040.00716.66
7.4.280.0020.00516.72
7.4.270.0000.01016.63
7.4.260.0070.00013.42
7.4.250.0030.00616.59
7.4.240.0030.00316.76
7.4.230.0070.00016.82
7.4.220.0180.00016.64
7.4.210.0080.00816.61
7.4.200.0040.00416.86
7.4.190.0030.00516.61
7.4.160.0080.00816.55
7.4.150.0070.01016.63
7.4.140.0130.00517.86
7.4.130.0180.00416.87
7.4.120.0150.00616.80
7.4.110.0130.01016.63
7.4.100.0140.00316.64
7.4.90.0140.01016.69
7.4.80.0150.00319.39
7.4.70.0090.00916.92
7.4.60.0070.01016.60
7.4.50.0030.00616.71
7.4.40.0090.00616.71
7.4.30.0110.00716.48
7.4.00.0060.01015.07
7.3.330.0030.00313.64
7.3.320.0060.00013.48
7.3.310.0030.00316.60
7.3.300.0030.00316.55
7.3.290.0090.00716.66
7.3.280.0110.00516.69
7.3.270.0060.01216.55
7.3.260.0160.00616.55
7.3.240.0070.01016.59
7.3.230.0090.00916.53
7.3.210.0110.01116.73
7.3.200.0060.01216.62
7.3.190.0120.00416.56
7.3.180.0060.01016.65
7.3.170.0100.00716.65
7.3.160.0110.00516.80
7.3.120.0050.01115.09
7.3.110.0130.00715.03
7.3.100.0040.01514.85
7.3.90.0120.00314.93
7.3.80.0070.00715.18
7.3.70.0030.01314.79
7.3.60.0000.01415.09
7.3.50.0150.00015.11
7.3.40.0030.01014.99
7.3.30.0000.01415.05
7.3.20.0030.01216.94
7.3.10.0000.01316.70
7.3.00.0110.00317.04
7.2.330.0070.01117.05
7.2.320.0070.01417.02
7.2.310.0110.01416.78
7.2.300.0070.01017.02
7.2.290.0180.00016.97
7.2.250.0030.01615.49
7.2.240.0070.01415.32
7.2.230.0030.01215.25
7.2.220.0120.00315.30
7.2.210.0030.01314.94
7.2.200.0130.00315.13
7.2.190.0080.00415.38
7.2.180.0080.00615.12
7.2.170.0060.00915.37
7.2.160.0030.00915.16
7.2.150.0030.00616.88
7.2.140.0040.01116.95
7.2.130.0090.00617.09
7.2.120.0040.01117.20
7.2.110.0000.01116.89
7.2.100.0100.00316.82
7.2.90.0090.00617.03
7.2.80.0120.00317.13
7.2.70.0030.00717.31
7.2.60.0190.01316.86
7.2.50.0080.01117.16
7.2.40.0070.01016.86
7.2.30.0090.00617.01
7.2.20.0070.01016.99
7.2.10.0030.01217.27
7.2.00.0080.00618.37
7.1.330.0060.01216.08
7.1.320.0070.00316.26
7.1.310.0030.00916.05
7.1.300.0120.00315.79
7.1.290.0040.01115.99
7.1.280.0070.00716.03
7.1.270.0120.00316.04
7.1.260.0030.01316.06
7.1.250.0120.00415.90
7.1.240.0000.01015.99
7.1.230.0000.01416.07
7.1.220.0130.00015.96
7.1.210.0040.00815.86
7.1.200.0050.00615.93
7.1.190.0070.00715.97
7.1.180.0030.01015.89
7.1.170.0070.00715.93
7.1.160.0030.00916.07
7.1.150.0000.01116.06
7.1.140.0130.00015.67
7.1.130.0070.01015.91
7.1.120.0060.00615.87
7.1.110.0040.00415.84
7.1.100.0050.00817.14
7.1.90.0060.00916.18
7.1.80.0060.00615.73
7.1.70.0060.00816.66
7.1.60.0090.01117.52
7.1.50.0060.01016.57
7.1.40.0070.00716.02
7.1.30.0040.00815.75
7.1.20.0040.00415.73
7.1.10.0070.00716.01
7.1.00.0020.02519.15
7.0.330.0030.01015.34
7.0.320.0090.00615.70
7.0.310.0040.01215.63
7.0.300.0070.00715.41
7.0.290.0070.01015.66
7.0.280.0000.01515.31
7.0.270.0070.01015.41
7.0.260.0000.01415.48
7.0.250.0000.01215.46
7.0.240.0090.00615.59
7.0.230.0030.00815.74
7.0.220.0000.00815.16
7.0.210.0110.00315.40
7.0.200.0000.01016.32
7.0.190.0100.00315.56
7.0.180.0070.00715.35
7.0.170.0060.00615.48
7.0.160.0030.00815.61
7.0.150.0060.00615.42
7.0.140.0070.03718.90
7.0.130.0000.00915.37
7.0.120.0060.00915.24
7.0.110.0030.00915.59
7.0.100.0130.02217.74
7.0.90.0080.02517.75
7.0.80.0070.02517.72
7.0.70.0080.02117.76
7.0.60.0080.02017.64
7.0.50.0050.02217.94
7.0.40.0030.03316.75
7.0.30.0040.02416.87
7.0.20.0040.02916.85
7.0.10.0050.02416.91
7.0.00.0030.03016.86
5.6.400.0070.00714.65
5.6.390.0070.00714.55
5.6.380.0000.01514.52
5.6.370.0070.00714.60
5.6.360.0110.00714.80
5.6.350.0090.00314.75
5.6.340.0070.01114.57
5.6.330.0070.00714.55
5.6.320.0080.00414.46
5.6.310.0030.01014.65
5.6.300.0060.00314.45
5.6.290.0080.00314.70
5.6.280.0050.04017.84
5.6.270.0040.01114.59
5.6.260.0060.00314.51
5.6.250.0030.03317.58
5.6.240.0050.02517.66
5.6.230.0020.02517.56
5.6.220.0030.02817.46
5.6.210.0050.02517.58
5.6.200.0050.04417.91
5.6.190.0040.02717.92
5.6.180.0050.02017.88
5.6.170.0100.02117.67
5.6.160.0070.02117.76
5.6.150.0050.02317.68
5.6.140.0060.02117.84
5.6.130.0070.02817.83
5.6.120.0120.02317.82
5.6.110.0060.03117.79
5.6.100.0080.02817.71
5.6.90.0120.02017.76
5.6.80.0110.04117.34
5.6.70.0050.02717.41
5.6.60.0000.04717.49
5.6.50.0050.02317.54
5.6.40.0060.02817.44
5.6.30.0070.04117.44
5.6.20.0050.04517.47
5.6.10.0020.02717.39
5.6.00.0100.03917.41
5.5.380.0020.02717.29
5.5.370.0080.02117.41
5.5.360.0060.02717.38
5.5.350.0080.03517.38
5.5.340.0050.02717.60
5.5.330.0050.02317.78
5.5.320.0050.02417.63
5.5.310.0060.02317.49
5.5.300.0050.02317.71
5.5.290.0110.02917.72
5.5.280.0090.04517.70
5.5.270.0140.02017.63
5.5.260.0070.02817.55
5.5.250.0130.03217.62
5.5.240.0120.02517.11
5.5.230.0050.02717.36
5.5.220.0100.03217.11
5.5.210.0050.02717.44
5.5.200.0080.03217.31
5.5.190.0100.04017.21
5.5.180.0070.04117.20
5.5.170.0060.01014.66
5.5.160.0080.04317.24
5.5.150.0080.04317.12
5.5.140.0050.04617.28
5.5.130.0080.03117.23
5.5.120.0030.03017.46
5.5.110.0070.04217.37
5.5.100.0070.04317.33
5.5.90.0090.03417.22
5.5.80.0080.02917.21
5.5.70.0080.02717.25
5.5.60.0080.03817.12
5.5.50.0050.04317.25
5.5.40.0030.03717.21
5.5.30.0030.04017.34
5.5.20.0100.02817.15
5.5.10.0120.04217.16
5.5.00.0070.04317.22
5.4.450.0070.04015.37
5.4.440.0070.03815.44
5.4.430.0080.02015.27
5.4.420.0020.02515.30
5.4.410.0080.03815.28
5.4.400.0120.02815.10
5.4.390.0120.03815.17
5.4.380.0070.03815.07
5.4.370.0030.02615.05
5.4.360.0100.04415.28
5.4.350.0080.03815.01
5.4.340.0000.03514.95
5.4.330.0070.00711.01
5.4.320.0030.02714.99
5.4.310.0090.02815.01
5.4.300.0060.04115.20
5.4.290.0060.04015.34
5.4.280.0030.04515.06
5.4.270.0050.02914.95
5.4.260.0080.03615.15
5.4.250.0030.04214.90
5.4.240.0040.02315.15
5.4.230.0100.03315.18
5.4.220.0050.04215.09
5.4.210.0070.02215.09
5.4.200.0080.03514.96
5.4.190.0090.03915.17
5.4.180.0020.03315.09
5.4.170.0050.04015.18
5.4.160.0080.03515.14
5.4.150.0070.02915.07
5.4.140.0080.03513.78
5.4.130.0020.04313.88
5.4.120.0100.03313.88
5.4.110.0060.02313.85
5.4.100.0050.03913.84
5.4.90.0030.04413.89
5.4.80.0080.03513.88
5.4.70.0160.02013.82
5.4.60.0070.04013.76
5.4.50.0030.04113.94
5.4.40.0050.03013.93
5.4.30.0050.04213.75
5.4.20.0050.04213.73
5.4.10.0020.04413.87
5.4.00.0010.03913.60
5.3.290.0020.03312.87
5.3.280.0050.02612.82
5.3.270.0110.03812.79
5.3.260.0090.02512.87
5.3.250.0050.02512.85
5.3.240.0070.03712.83
5.3.230.0070.04012.85
5.3.220.0060.04212.84
5.3.210.0080.03512.74
5.3.200.0050.04112.78
5.3.190.0050.04212.85
5.3.180.0070.04012.79
5.3.170.0080.03812.77
5.3.160.0000.03712.79
5.3.150.0070.04012.80
5.3.140.0110.03312.74
5.3.130.0080.03912.73
5.3.120.0110.03712.78
5.3.110.0030.04212.76
5.3.100.0030.04512.57
5.3.90.0080.03812.51
5.3.80.0050.04112.44
5.3.70.0050.04112.45
5.3.60.0060.03912.48
5.3.50.0070.03612.49
5.3.40.0080.03312.44
5.3.30.0050.03612.44
5.3.20.0050.02312.37
5.3.10.0000.03912.33
5.3.00.0050.03612.32
5.2.170.0030.04311.07
5.2.160.0070.06011.20
5.2.150.0070.06011.22
5.2.140.0100.06011.26
5.2.130.0030.04711.20
5.2.120.0130.04711.22
5.2.110.0070.04711.04
5.2.100.0100.05711.12
5.2.90.0030.06011.18
5.2.80.0000.06711.26
5.2.70.0070.05011.26
5.2.60.0000.06310.98
5.2.50.0000.06011.16
5.2.40.0030.06311.16
5.2.30.0000.06311.06
5.2.20.0070.06310.91
5.2.10.0000.05310.82
5.2.00.0130.03710.71
5.1.60.0070.0379.86
5.1.50.0030.05310.11
5.1.40.0030.05710.09
5.1.30.0000.05310.39
5.1.20.0030.04310.29
5.1.10.0000.0579.95
5.1.00.0000.05310.09
5.0.50.0030.0438.65
5.0.40.0000.0478.29
5.0.30.0000.0678.10
5.0.20.0130.0308.29
5.0.10.0030.0438.20
5.0.00.0030.0638.20
4.4.90.0000.0377.48
4.4.80.0030.0377.48
4.4.70.0100.0277.48
4.4.60.0070.0307.48
4.4.50.0030.0137.48
4.4.40.0000.0407.48
4.4.30.0130.0237.48
4.4.20.0070.0337.48
4.4.10.0030.0337.48
4.4.00.0130.0437.48
4.3.110.0000.0377.48
4.3.100.0000.0337.48
4.3.90.0000.0377.48
4.3.80.0000.0577.48
4.3.70.0030.0277.48
4.3.60.0030.0177.48
4.3.50.0030.0377.48
4.3.40.0000.0577.48
4.3.30.0000.0337.48
4.3.20.0000.0237.48
4.3.10.0000.0377.48
4.3.00.0070.0277.48

preferences:
70.14 ms | 401 KiB | 5 Q