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"; $str2 = "2009-01-01"; $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($str2)); $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.0120.00316.63
8.3.50.0120.00721.97
8.3.40.0060.00918.79
8.3.30.0090.00619.23
8.3.20.0000.00820.16
8.3.10.0000.00921.74
8.3.00.0060.00319.36
8.2.180.0090.00918.50
8.2.170.0090.00622.96
8.2.160.0110.01120.44
8.2.150.0050.00324.18
8.2.140.0030.00524.66
8.2.130.0040.00426.16
8.2.120.0000.00822.05
8.2.110.0070.00319.34
8.2.100.0080.00417.97
8.2.90.0030.00619.39
8.2.80.0080.00017.97
8.2.70.0060.00317.88
8.2.60.0060.00317.93
8.2.50.0000.00818.07
8.2.40.0040.00419.88
8.2.30.0000.01118.07
8.2.20.0050.00317.84
8.2.10.0000.00918.16
8.2.00.0040.00418.03
8.1.280.0170.00325.92
8.1.270.0050.00323.98
8.1.260.0080.00026.35
8.1.250.0080.00028.09
8.1.240.0070.00321.24
8.1.230.0080.00417.70
8.1.220.0030.00617.76
8.1.210.0030.00618.77
8.1.200.0030.00717.60
8.1.190.0080.00017.48
8.1.180.0000.00918.10
8.1.170.0040.00418.64
8.1.160.0030.00622.05
8.1.150.0040.00418.67
8.1.140.0030.00517.52
8.1.130.0040.00417.86
8.1.120.0040.00417.57
8.1.110.0000.00817.59
8.1.100.0030.00617.59
8.1.90.0080.00017.53
8.1.80.0030.00517.66
8.1.70.0000.00717.50
8.1.60.0060.00317.68
8.1.50.0050.00317.50
8.1.40.0030.00617.51
8.1.30.0040.00417.66
8.1.20.0000.00817.57
8.1.10.0050.00317.73
8.1.00.0040.00417.57
8.0.300.0030.00618.77
8.0.290.0040.00416.88
8.0.280.0040.00418.38
8.0.270.0070.00017.33
8.0.260.0030.00318.48
8.0.250.0050.00217.10
8.0.240.0030.00617.18
8.0.230.0030.00317.07
8.0.220.0070.00017.02
8.0.210.0000.00717.12
8.0.200.0060.00317.24
8.0.190.0070.00317.17
8.0.180.0000.00817.14
8.0.170.0060.00317.04
8.0.160.0000.00817.12
8.0.150.0060.00316.95
8.0.140.0080.00016.96
8.0.130.0000.00613.52
8.0.120.0090.00016.99
8.0.110.0040.00417.19
8.0.100.0000.00717.10
8.0.90.0000.00817.08
8.0.80.0070.01517.16
8.0.70.0050.00317.19
8.0.60.0040.00416.93
8.0.50.0060.00317.13
8.0.30.0110.00917.39
8.0.20.0080.01017.40
8.0.10.0040.00417.17
8.0.00.0110.01116.86
7.4.330.0030.00315.16
7.4.320.0070.00016.64
7.4.300.0030.00316.55
7.4.290.0030.00516.59
7.4.280.0000.00816.58
7.4.270.0040.00416.69
7.4.260.0000.00816.65
7.4.250.0090.00016.63
7.4.240.0020.00516.64
7.4.230.0000.00816.64
7.4.220.0060.01216.58
7.4.210.0030.01216.66
7.4.200.0020.00516.43
7.4.190.0050.00316.74
7.4.160.0050.01116.49
7.4.150.0120.01217.40
7.4.140.0180.01017.86
7.4.130.0080.01116.71
7.4.120.0060.01216.64
7.4.110.0060.01616.63
7.4.100.0070.01116.85
7.4.90.0030.01616.62
7.4.80.0060.01219.39
7.4.70.0280.02116.67
7.4.60.0030.01416.56
7.4.50.0050.00416.70
7.4.40.0070.01016.71
7.4.30.0110.00616.47
7.4.00.0030.01414.87
7.3.330.0030.00313.45
7.3.320.0030.00313.65
7.3.310.0040.00416.63
7.3.300.0070.00016.58
7.3.290.0160.00616.55
7.3.280.0040.01316.55
7.3.270.0060.01317.40
7.3.260.0120.00816.52
7.3.250.0110.01016.69
7.3.240.0120.00616.52
7.3.230.0190.00016.70
7.3.210.0080.00916.75
7.3.200.0090.01519.39
7.3.190.0120.01216.66
7.3.180.0060.01216.54
7.3.170.0140.00316.69
7.3.160.0100.00716.69
7.3.120.0080.00814.99
7.3.110.0060.01014.73
7.3.100.0030.01614.81
7.3.90.0040.01114.86
7.3.80.0100.00614.88
7.3.70.0000.01514.98
7.3.60.0060.00614.93
7.3.50.0080.00414.73
7.3.40.0060.01214.91
7.3.30.0030.01014.93
7.3.20.0160.00016.59
7.3.10.0030.01316.96
7.3.00.0090.00616.88
7.2.330.0060.01316.98
7.2.320.0140.00816.91
7.2.310.0060.01216.99
7.2.300.0080.00816.62
7.2.290.0080.01116.61
7.2.250.0030.01215.38
7.2.240.0080.00815.30
7.2.230.0070.01015.11
7.2.220.0000.01415.23
7.2.210.0110.00715.23
7.2.200.0030.01415.15
7.2.190.0070.01015.09
7.2.180.0130.00315.32
7.2.170.0070.00715.27
7.2.160.0030.01015.21
7.2.150.0070.00316.91
7.2.140.0030.01317.03
7.2.130.0060.00817.06
7.2.120.0090.00617.00
7.2.110.0030.01317.05
7.2.100.0070.01116.77
7.2.90.0000.01616.97
7.2.80.0070.01016.91
7.2.70.0060.00917.14
7.2.60.0060.00816.86
7.2.50.0070.00717.16
7.2.40.0030.01017.11
7.2.30.0070.01016.91
7.2.20.0080.00416.87
7.2.10.0070.01017.19
7.2.00.0050.01118.37
7.1.330.0120.00616.07
7.1.320.0030.01215.94
7.1.310.0060.00316.17
7.1.300.0040.01115.79
7.1.290.0060.00916.05
7.1.280.0060.00616.05
7.1.270.0060.00615.95
7.1.260.0130.00315.82
7.1.250.0000.01616.05
7.1.240.0040.01116.06
7.1.230.0070.00715.82
7.1.220.0100.00315.85
7.1.210.0060.01015.98
7.1.200.0030.01015.96
7.1.190.0170.00015.74
7.1.180.0040.01115.99
7.1.170.0030.01115.91
7.1.160.0070.00316.02
7.1.150.0030.01015.88
7.1.140.0000.01315.82
7.1.130.0070.01015.80
7.1.120.0060.01216.00
7.1.110.0070.00715.82
7.1.100.0040.01017.11
7.1.90.0040.01115.88
7.1.80.0070.00716.01
7.1.70.0020.01416.59
7.1.60.0020.01317.69
7.1.50.0040.01616.51
7.1.40.0090.00615.66
7.1.30.0060.01015.95
7.1.20.0060.00916.10
7.1.10.0040.01215.84
7.1.00.0080.03819.16
7.0.330.0070.00715.51
7.0.320.0040.00415.34
7.0.310.0030.01015.73
7.0.300.0060.00915.71
7.0.290.0070.01015.63
7.0.280.0030.00915.68
7.0.270.0030.01315.54
7.0.260.0070.00715.50
7.0.250.0100.00715.65
7.0.240.0070.01015.48
7.0.230.0030.01215.64
7.0.220.0000.01815.62
7.0.210.0060.01315.39
7.0.200.0040.00716.20
7.0.190.0070.00715.25
7.0.180.0040.01115.60
7.0.170.0120.00315.45
7.0.160.0060.00915.50
7.0.150.0000.01315.68
7.0.140.0060.03718.74
7.0.130.0090.00615.72
7.0.120.0080.00815.25
7.0.110.0030.00915.60
7.0.100.0030.04417.89
7.0.90.0080.04317.71
7.0.80.0270.05217.77
7.0.70.0220.02617.60
7.0.60.0030.03217.88
7.0.50.0220.03717.91
7.0.40.0070.04016.87
7.0.30.0050.04616.85
7.0.20.0020.03216.93
7.0.10.0110.04116.84
7.0.00.0070.04416.90
5.6.400.0100.01014.27
5.6.390.0030.01214.75
5.6.380.0030.01014.53
5.6.370.0060.00914.48
5.6.360.0030.01614.38
5.6.350.0070.01114.72
5.6.340.0060.00614.76
5.6.330.0120.00914.63
5.6.320.0060.00914.65
5.6.310.0100.01014.70
5.6.300.0040.01114.53
5.6.290.0000.01214.80
5.6.280.0070.04017.67
5.6.270.0030.01014.67
5.6.260.0120.00414.43
5.6.250.0130.03817.60
5.6.240.0030.02917.61
5.6.230.0070.03317.62
5.6.220.0120.03917.63
5.6.210.0020.05017.70
5.6.200.0060.03817.76
5.6.190.0030.03817.70
5.6.180.0030.04417.97
5.6.170.0030.05217.75
5.6.160.0070.02917.79
5.6.150.0060.03817.92
5.6.140.0080.02417.78
5.6.130.0070.02617.70
5.6.120.0060.02517.62
5.6.110.0100.02217.96
5.6.100.0030.02217.67
5.6.90.0050.02717.70
5.6.80.0030.02617.40
5.6.70.0030.02617.38
5.6.60.0070.02217.55
5.6.50.0050.02217.44
5.6.40.0040.03017.51
5.6.30.0080.02317.31
5.6.20.0080.03017.38
5.6.10.0020.02717.32
5.6.00.0070.03017.41
5.5.380.0050.04417.65
5.5.370.0050.03317.62
5.5.360.0020.03317.53
5.5.350.0050.04417.44
5.5.340.0070.02817.78
5.5.330.0100.04217.52
5.5.320.0050.03017.70
5.5.310.0100.03517.79
5.5.300.0110.01717.50
5.5.290.0000.02817.78
5.5.280.0070.02517.77
5.5.270.0030.02517.73
5.5.260.0020.02817.71
5.5.250.0050.02617.39
5.5.240.0080.02117.38
5.5.230.0090.02017.44
5.5.220.0040.02917.26
5.5.210.0070.02717.28
5.5.200.0030.02517.42
5.5.190.0030.02917.28
5.5.180.0040.02417.32
5.5.170.0030.01014.50
5.5.160.0050.02717.38
5.5.150.0030.02717.34
5.5.140.0050.02817.38
5.5.130.0080.02017.19
5.5.120.0050.02417.36
5.5.110.0100.01917.43
5.5.100.0060.02317.24
5.5.90.0040.02417.37
5.5.80.0000.03017.37
5.5.70.0050.02717.42
5.5.60.0060.04217.15
5.5.50.0070.02017.13
5.5.40.0070.02217.31
5.5.30.0080.02117.35
5.5.20.0050.02617.36
5.5.10.0020.02617.19
5.5.00.0100.02017.06
5.4.450.0050.02415.37
5.4.440.0070.02515.28
5.4.430.0060.02015.39
5.4.420.0060.02515.32
5.4.410.0080.02015.44
5.4.400.0070.01815.21
5.4.390.0040.02415.12
5.4.380.0080.01815.26
5.4.370.0030.02515.35
5.4.360.0080.03515.29
5.4.350.0070.02414.91
5.4.340.0070.02215.10
5.4.330.0060.00611.09
5.4.320.0070.02814.96
5.4.310.0030.02415.10
5.4.300.0030.02515.14
5.4.290.0060.02615.20
5.4.280.0000.02915.16
5.4.270.0030.03015.20
5.4.260.0030.02015.30
5.4.250.0030.02515.12
5.4.240.0090.01615.20
5.4.230.0050.02215.07
5.4.220.0050.02914.86
5.4.210.0030.02315.17
5.4.200.0070.02515.08
5.4.190.0050.02315.20
5.4.180.0050.02315.08
5.4.170.0060.02115.11
5.4.160.0030.02615.23
5.4.150.0020.04615.24
5.4.140.0050.04113.99
5.4.130.0080.04013.81
5.4.120.0020.02313.96
5.4.110.0070.03113.85
5.4.100.0070.03813.89
5.4.90.0130.03313.95
5.4.80.0030.03113.67
5.4.70.0080.04013.71
5.4.60.0100.03813.88
5.4.50.0080.03713.70
5.4.40.0070.03813.75
5.4.30.0040.03713.88
5.4.20.0020.03613.79
5.4.10.0070.02313.88
5.4.00.0030.04313.58
5.3.290.0040.02412.80
5.3.280.0000.03512.70
5.3.270.0080.01712.75
5.3.260.0060.02312.83
5.3.250.0030.04712.77
5.3.240.0110.03712.61
5.3.230.0070.03712.79
5.3.220.0050.03812.64
5.3.210.0070.04412.44
5.3.200.0020.04212.58
5.3.190.0080.03912.61
5.3.180.0040.04512.66
5.3.170.0030.04612.80
5.3.160.0040.04012.61
5.3.150.0060.04212.62
5.3.140.0080.04212.71
5.3.130.0050.03512.73
5.3.120.0120.03212.71
5.3.110.0070.04012.56
5.3.100.0080.04512.38
5.3.90.0070.04212.39
5.3.80.0060.03812.32
5.3.70.0050.02612.26
5.3.60.0090.03712.30
5.3.50.0080.03212.37
5.3.40.0060.03712.33
5.3.30.0100.02912.34
5.3.20.0050.03012.25
5.3.10.0050.03512.09
5.3.00.0030.04112.03
5.2.170.0070.04711.27
5.2.160.0030.04311.28
5.2.150.0030.06311.07
5.2.140.0070.05311.18
5.2.130.0000.03711.19
5.2.120.0030.06311.27
5.2.110.0030.05311.18
5.2.100.0070.06311.11
5.2.90.0000.05711.04
5.2.80.0000.04011.05
5.2.70.0070.06011.11
5.2.60.0070.06011.18
5.2.50.0030.06011.04
5.2.40.0000.05010.91
5.2.30.0100.04311.09
5.2.20.0100.05310.91
5.2.10.0070.05710.83
5.2.00.0030.04710.73
5.1.60.0030.05310.34
5.1.50.0030.05310.34
5.1.40.0000.03310.34
5.1.30.0030.03310.39
5.1.20.0100.05010.36
5.1.10.0070.05310.34
5.1.00.0070.05710.34
5.0.50.0000.04710.34
5.0.40.0000.03310.34
5.0.30.0070.05310.34
5.0.20.0030.03310.34
5.0.10.0000.02310.34
5.0.00.0030.06310.34
4.4.90.0070.02710.34
4.4.80.0030.03710.34
4.4.70.0000.04010.34
4.4.60.0000.04010.34
4.4.50.0030.02710.34
4.4.40.0030.05310.34
4.4.30.0030.03710.34
4.4.20.0000.04010.34
4.4.10.0000.03010.34
4.4.00.0130.04710.34
4.3.110.0030.02310.34
4.3.100.0030.03310.34
4.3.90.0000.02010.34
4.3.80.0100.03310.34
4.3.70.0000.03710.34
4.3.60.0030.03310.34
4.3.50.0000.02010.34
4.3.40.0030.05010.34
4.3.30.0000.03710.34
4.3.20.0000.03310.34
4.3.10.0030.03010.34
4.3.00.0000.03710.34

preferences:
47.21 ms | 401 KiB | 5 Q