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; $date1 = new DateTime($str1); $n = 0; while(strtotime($tempdate1) <= strtotime($str2)) { $date2 = new DateTime($tempdate1); $interval = $date1->diff($date2); $string1 = "(" . $interval->days . ") difference " . $interval->y . " years, " . $interval->m . " months, " . $interval->d . " days, " . $interval->h . " hours, " . $interval->i . " minutes, and " . $interval->s . " seconds"; $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"; 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 += 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.0090.01216.88
8.3.50.0110.00918.51
8.3.40.0120.01918.98
8.3.30.0190.00019.09
8.3.20.0030.00619.07
8.3.10.0070.00318.94
8.3.00.0000.00919.63
8.2.180.0200.00317.00
8.2.170.0270.00522.96
8.2.160.0180.01519.01
8.2.150.0070.00424.18
8.2.140.0070.01424.66
8.2.130.0030.00626.16
8.2.120.0110.00419.79
8.2.110.0060.00621.23
8.2.100.0290.00018.34
8.2.90.0070.00419.29
8.2.80.0000.00817.97
8.2.70.0090.00917.99
8.2.60.0030.00518.18
8.2.50.0070.00317.80
8.2.40.0040.01219.73
8.2.30.0040.00718.03
8.2.20.0040.00818.13
8.2.10.0080.00018.17
8.2.00.0070.00318.30
8.1.280.0100.01025.92
8.1.270.0060.00323.99
8.1.260.0090.00026.35
8.1.250.0000.01028.09
8.1.240.0100.00021.23
8.1.230.0040.00918.02
8.1.220.0040.00417.89
8.1.210.0040.00718.77
8.1.200.0030.00717.38
8.1.190.0040.00717.60
8.1.180.0000.01518.10
8.1.170.0060.00617.62
8.1.160.0090.00019.15
8.1.150.0110.00419.03
8.1.140.0050.00317.79
8.1.130.0130.00419.51
8.1.120.0000.01117.82
8.1.110.0040.00917.68
8.1.100.0050.00317.81
8.1.90.0000.00817.70
8.1.80.0070.01017.70
8.1.70.0040.00417.81
8.1.60.0090.00017.76
8.1.50.0040.01317.75
8.1.40.0060.00317.78
8.1.30.0030.00717.95
8.1.20.0050.00917.93
8.1.10.0040.00817.86
8.1.00.0090.00017.75
8.0.300.0050.00918.90
8.0.290.0030.00916.88
8.0.280.0100.00318.74
8.0.270.0030.00917.32
8.0.260.0040.00817.02
8.0.250.0060.00917.20
8.0.240.0080.00817.16
8.0.230.0040.01417.15
8.0.220.0040.01117.10
8.0.210.0000.01417.21
8.0.200.0000.01417.06
8.0.190.0060.01017.16
8.0.180.0070.00417.25
8.0.170.0060.00617.11
8.0.160.0100.00517.18
8.0.150.0090.00917.12
8.0.140.0040.01217.21
8.0.130.0070.00713.77
8.0.120.0090.00917.22
8.0.110.0030.00617.12
8.0.100.0000.01517.17
8.0.90.0030.01217.16
8.0.80.0250.01517.23
8.0.70.0080.00417.16
8.0.60.0040.00717.05
8.0.50.0080.00316.95
8.0.30.0320.02317.39
8.0.20.0310.02417.36
8.0.10.0040.00817.31
8.0.00.0280.02216.94
7.4.330.0070.00713.21
7.4.320.0000.01516.62
7.4.300.0000.01216.61
7.4.290.0080.01216.65
7.4.280.0030.01316.70
7.4.270.0060.00616.55
7.4.260.0000.00813.54
7.4.250.0000.01716.59
7.4.240.0000.01216.69
7.4.230.0000.00916.69
7.4.220.0300.01716.47
7.4.210.0030.01716.80
7.4.200.0040.00816.64
7.4.190.0060.00916.70
7.4.160.0420.03016.86
7.4.150.0470.03016.72
7.4.140.0160.02017.86
7.4.130.0390.04216.71
7.4.120.0160.03616.62
7.4.110.0060.02216.67
7.4.100.0330.02916.71
7.4.90.0950.02716.64
7.4.80.0300.02019.39
7.4.70.0130.02316.72
7.4.60.0250.02816.80
7.4.50.0100.01016.74
7.4.40.0090.01216.61
7.4.30.0390.01716.89
7.3.330.0050.00913.55
7.3.320.0030.00713.70
7.3.310.0040.01216.46
7.3.300.0060.00616.65
7.3.290.0100.03016.61
7.3.280.0050.03416.62
7.3.270.0430.01916.50
7.3.260.0150.04316.45
7.3.240.0280.01116.57
7.3.230.0770.03316.75
7.3.210.0300.03716.74
7.3.200.0950.02716.66
7.3.190.0120.00916.59
7.3.180.0340.02416.55
7.3.170.0860.02616.56
7.3.160.0500.03316.79
7.2.330.0280.02917.05
7.2.320.0110.03217.02
7.2.310.0240.03416.84
7.2.300.0170.02717.06
7.2.290.0350.02116.99
7.2.110.0100.00716.58
7.2.100.0360.00716.70
7.2.90.0220.00416.89
7.2.80.0280.00616.78
7.2.70.0230.00717.16
7.2.60.0110.01417.17
7.2.50.0240.00617.08
7.2.40.0210.01117.10
7.2.30.0100.01317.20
7.2.20.0150.00917.17
7.2.10.0180.00917.15
7.2.00.0060.01817.97
7.1.230.0130.01115.84
7.1.220.2290.01016.02
7.1.210.0200.00715.89
7.1.200.0170.01015.79
7.1.190.0260.00415.93
7.1.180.0190.00615.92
7.1.170.0220.01115.99
7.1.160.0310.00916.03
7.1.150.0170.01316.01
7.1.140.0090.01315.65
7.1.130.0160.00915.81
7.1.120.0160.00715.94
7.1.110.0140.00916.01
7.1.100.0110.00717.09
7.1.90.0170.01016.07
7.1.80.0130.01315.89
7.1.70.0060.01316.56
7.1.60.0070.01217.63
7.1.50.0100.01516.93
7.1.40.0240.00416.25
7.1.30.0380.01615.98
7.1.20.0120.01616.27
7.1.10.0000.01915.79
7.1.00.0070.03819.11
7.0.310.0180.01615.41
7.0.300.0240.00915.34
7.0.290.0150.01815.54
7.0.280.0130.00915.36
7.0.270.0050.01915.54
7.0.260.0140.01015.30
7.0.250.0090.00915.39
7.0.240.0110.00815.66
7.0.230.0260.00315.37
7.0.220.0090.00915.77
7.0.210.0140.00915.74
7.0.200.0020.01516.33
7.0.190.0150.01115.55
7.0.180.0110.00715.54
7.0.170.0150.00615.24
7.0.160.0110.01615.44
7.0.150.0150.00315.53
7.0.140.0130.04218.60
7.0.130.0130.00715.71
7.0.120.0090.04318.79
7.0.110.0030.02015.64
7.0.100.0160.00615.70
7.0.90.0180.04917.69
7.0.80.0290.05017.58
7.0.70.0570.04817.81
7.0.60.0320.04417.71
7.0.50.0390.03917.99
7.0.40.0100.04816.81
7.0.30.0060.05616.83
7.0.20.0130.02616.96
7.0.10.0060.04616.71
7.0.00.0120.04916.88
5.6.380.0030.02514.69
5.6.370.0120.01214.53
5.6.360.0180.00714.76
5.6.350.0160.01014.71
5.6.340.0100.01714.37
5.6.330.0160.00314.62
5.6.320.0120.01214.57
5.6.310.0060.01314.52
5.6.300.0140.01414.64
5.6.290.0030.02314.44
5.6.280.0070.04717.90
5.6.270.0240.00414.52
5.6.260.0040.02014.51
5.6.250.0180.00714.50
5.6.240.0080.04817.67
5.6.230.0110.05817.54
5.6.220.0160.02917.54
5.6.210.0150.04417.62
5.6.200.0090.04117.88
5.6.190.0140.05017.83
5.6.180.0110.04617.81
5.6.170.0110.05517.95
5.6.160.0160.04817.72
5.6.150.0100.04417.88
5.6.140.0070.05717.89
5.6.130.0160.04517.83
5.6.120.0070.05917.94
5.6.110.0110.05317.86
5.6.100.0090.05417.95
5.6.90.0110.05217.81
5.6.80.0120.04917.44
5.6.70.0080.04717.52
5.6.60.0120.03217.57
5.6.50.0080.04517.53
5.6.40.0090.04217.31
5.6.30.0190.04717.38
5.6.20.0160.04717.45
5.6.10.0100.05017.52
5.6.00.0130.04817.36
5.5.380.0100.02716.68
5.5.370.0120.04216.66
5.5.360.0150.03916.61
5.5.350.0210.03716.63
5.5.340.0090.04416.88
5.5.330.0130.04216.85
5.5.320.0160.03616.88
5.5.310.0120.04216.81
5.5.300.0120.04416.86
5.5.290.0200.04016.85
5.5.280.0160.03816.87
5.5.270.0160.04316.84
5.5.260.0080.05516.85
5.5.250.0150.03616.72
5.5.240.0150.04416.48
5.5.230.0120.05416.56
5.5.220.0100.04316.48
5.5.210.0170.04516.54
5.5.200.0120.04816.48
5.5.190.0400.03516.56
5.5.180.0070.04616.58
5.5.170.0160.01014.50
5.5.160.0120.04216.51
5.5.150.0170.03016.44
5.5.140.0080.04216.53
5.5.130.0080.04516.55
5.5.120.0140.03416.53
5.5.110.0180.05316.51
5.5.100.0140.04316.42
5.5.90.0100.03916.45
5.5.80.0150.03816.41
5.5.70.0160.03716.49
5.5.60.0140.03616.42
5.5.50.0120.04016.41
5.5.40.0070.04516.48
5.5.30.0120.04516.47
5.5.20.0090.04216.39
5.5.10.0120.03916.43
5.5.00.0100.03916.41
5.4.450.0160.03816.01
5.4.440.0180.04016.08
5.4.430.0100.04716.10
5.4.420.0140.03616.00
5.4.410.0180.03716.03
5.4.400.0120.03715.94
5.4.390.0190.03315.93
5.4.380.0050.04615.96
5.4.370.0150.05016.00
5.4.360.0180.03715.85
5.4.350.0150.03815.92
5.4.340.0050.04515.91
5.4.330.0110.00812.79
5.4.320.0140.03515.94
5.4.310.0100.04015.83
5.4.300.0070.04415.92
5.4.290.0100.04315.83
5.4.280.0120.04715.95
5.4.270.0110.03815.94
5.4.260.0160.03515.95
5.4.250.0170.05115.93
5.4.240.0110.04415.93
5.4.230.0090.06615.92
5.4.220.0160.03215.94
5.4.210.0090.04515.95
5.4.200.0070.03915.91
5.4.190.0150.04716.01
5.4.180.0120.03815.86
5.4.170.0070.04015.93
5.4.160.0080.03816.00
5.4.150.0120.03315.90
5.4.140.0130.03614.55
5.4.130.0070.04114.56
5.4.120.0140.03514.55
5.4.110.0050.04414.63
5.4.100.0120.04014.61
5.4.90.0080.03814.64
5.4.80.0130.03314.67
5.4.70.0110.03914.63
5.4.60.0110.03814.65
5.4.50.0090.04514.65
5.4.40.0080.04814.58
5.4.30.0120.03714.62
5.4.20.0130.03614.65
5.4.10.0120.03914.54
5.4.00.0060.03814.30
5.3.290.0120.03813.68
5.3.280.0160.05113.64
5.3.270.0150.03913.65
5.3.260.0100.03113.65
5.3.250.0200.03013.64
5.3.240.0180.03113.64
5.3.230.0080.03913.64
5.3.220.0130.03713.60
5.3.210.0130.03713.60
5.3.200.0050.03713.63
5.3.190.0050.04013.60
5.3.180.0160.02513.60
5.3.170.0170.02713.61
5.3.160.0190.04413.60
5.3.150.0050.04013.62
5.3.140.0080.03513.63
5.3.130.0110.03413.62
5.3.120.0060.04113.61
5.3.110.0180.03213.54
5.3.100.0130.03713.36
5.3.90.0130.03413.30
5.3.80.0090.03413.31
5.3.70.0120.03413.38
5.3.60.0030.04113.30
5.3.50.0020.04713.29
5.3.40.0050.04313.30
5.3.30.0080.04113.27
5.3.20.0100.03713.13
5.3.10.0110.03713.20
5.3.00.0090.03613.19

preferences:
40.3 ms | 401 KiB | 5 Q