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; 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"; $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.70.0210.02116.58
8.3.60.0140.02118.68
8.3.50.0120.01721.02
8.3.40.0140.01419.05
8.3.30.0140.00720.34
8.3.20.0040.00820.51
8.3.10.0090.00622.23
8.3.00.0000.01722.46
8.2.180.0070.02616.75
8.2.170.0110.01822.96
8.2.160.0100.01022.21
8.2.150.0090.00624.18
8.2.140.0000.01124.66
8.2.130.0000.01126.16
8.2.120.0210.00921.05
8.2.110.0000.01222.23
8.2.100.0100.00619.82
8.2.90.0070.00419.48
8.2.80.0070.00319.36
8.2.70.0000.01118.00
8.2.60.0030.01018.05
8.2.50.0060.00918.07
8.2.40.0040.00718.46
8.2.30.0030.00819.52
8.2.20.0040.00818.19
8.2.10.0000.01018.14
8.2.00.0040.01118.20
8.1.280.0140.01425.92
8.1.270.0090.00323.99
8.1.260.0060.00926.35
8.1.250.0090.00328.09
8.1.240.0080.00823.81
8.1.230.0000.01819.24
8.1.220.0070.00317.79
8.1.210.0030.00718.77
8.1.200.0000.01517.48
8.1.190.0070.00417.54
8.1.180.0050.00818.10
8.1.170.0000.01218.75
8.1.160.0040.00819.14
8.1.150.0090.00319.04
8.1.140.0030.00717.80
8.1.130.0030.00618.08
8.1.120.0030.01017.82
8.1.110.0030.00617.82
8.1.100.0030.01017.75
8.1.90.0000.01017.70
8.1.80.0030.01617.83
8.1.70.0090.00017.77
8.1.60.0040.01117.88
8.1.50.0030.01717.74
8.1.40.0100.00717.80
8.1.30.0030.00717.80
8.1.20.0030.01017.77
8.1.10.0030.00917.84
8.1.00.0030.01017.85
8.0.300.0070.00318.77
8.0.290.0030.00817.18
8.0.280.0000.01018.54
8.0.270.0060.00617.09
8.0.260.0040.00817.02
8.0.250.0060.00617.23
8.0.240.0030.01317.16
8.0.230.0030.00717.19
8.0.220.0030.01617.20
8.0.210.0030.00717.16
8.0.200.0060.00617.14
8.0.190.0000.01417.20
8.0.180.0000.01217.17
8.0.170.0040.01017.16
8.0.160.0100.01317.12
8.0.150.0030.01017.08
8.0.140.0000.01117.15
8.0.130.0030.01213.65
8.0.120.0060.00917.02
8.0.110.0100.00317.00
8.0.100.0060.00617.20
8.0.90.0040.00717.16
8.0.80.0100.01417.07
8.0.70.0070.00717.05
8.0.60.0040.00717.14
8.0.50.0000.01017.00
8.0.30.0270.03317.21
8.0.20.0130.02117.40
8.0.10.0030.00917.10
8.0.00.0320.03817.02
7.4.330.0040.00416.90
7.4.320.0030.01016.55
7.4.300.0030.01316.61
7.4.290.0040.01116.66
7.4.280.0000.01216.71
7.4.270.0060.00616.70
7.4.260.0070.00313.39
7.4.250.0040.01816.59
7.4.240.0060.00816.55
7.4.230.0050.00516.39
7.4.220.0070.04116.76
7.4.210.0090.02016.67
7.4.200.0030.01016.79
7.4.190.0030.01016.47
7.4.160.0080.05616.82
7.4.150.0280.01717.40
7.4.140.0180.01117.86
7.4.130.0370.04016.72
7.4.120.0250.03316.63
7.4.110.0140.02116.61
7.4.100.0690.04816.70
7.4.90.0630.05116.67
7.4.80.0260.04119.39
7.4.70.0030.03316.42
7.4.60.0100.03516.59
7.4.50.0030.01016.58
7.4.40.0100.02022.77
7.4.30.0090.02216.79
7.4.00.0110.01415.09
7.3.330.0060.00313.58
7.3.320.0030.00713.71
7.3.310.0000.01016.61
7.3.300.0060.00616.57
7.3.290.0130.02516.57
7.3.280.0100.02416.60
7.3.270.0340.03717.40
7.3.260.0220.04718.24
7.3.250.0160.02116.63
7.3.240.0290.02216.43
7.3.230.0270.03816.59
7.3.210.0150.05616.52
7.3.200.0160.02219.39
7.3.190.0460.04016.89
7.3.180.0160.03516.48
7.3.170.0200.01916.58
7.3.160.0320.04416.70
7.3.120.0100.02615.20
7.2.330.0480.07216.71
7.2.320.0290.04216.96
7.2.310.0060.02016.80
7.2.300.0120.02716.74
7.2.290.0350.03516.59
7.2.00.0130.01919.64
7.1.100.0040.01818.07
7.1.70.0070.00317.25
7.1.60.0060.02619.17
7.1.50.0040.01117.32
7.1.00.0170.07322.34
7.0.200.0070.01416.94
7.0.140.0070.08022.13
7.0.100.0030.09019.96
7.0.90.0100.05719.97
7.0.80.0070.04319.97
7.0.70.0030.06720.02
7.0.60.0030.07019.89
7.0.50.0030.09720.24
7.0.40.0100.08720.14
7.0.30.0070.08720.08
7.0.20.0030.05720.10
7.0.10.0100.04320.04
7.0.00.0070.07020.09
5.6.280.0030.08720.93
5.6.250.0130.08720.54
5.6.240.0100.08720.54
5.6.230.0000.10020.68
5.6.220.0100.09020.70
5.6.210.0030.09720.48
5.6.200.0100.09721.05
5.6.190.0100.09321.11
5.6.180.0100.06021.14
5.6.170.0100.04721.04
5.6.160.0070.04321.14
5.6.150.0030.05321.05
5.6.140.0000.05021.02
5.6.130.0100.06021.19
5.6.120.0070.05721.10
5.6.110.0130.09321.19
5.6.100.0100.08321.12
5.6.90.0100.10720.94
5.6.80.0030.08320.43
5.6.70.0000.04720.45
5.6.60.0070.07720.40
5.6.50.0130.07020.41
5.6.40.0030.05720.46
5.6.30.0070.04020.46
5.6.20.0030.04320.41
5.6.10.0100.04020.39
5.6.00.0070.04320.38
5.5.380.0070.09720.48
5.5.370.0070.09020.42
5.5.360.0070.09320.58
5.5.350.0100.09020.45
5.5.340.0070.05320.82
5.5.330.0030.06320.78
5.5.320.0130.06020.82
5.5.310.0100.04320.81
5.5.300.0100.05720.93
5.5.290.0030.04320.86
5.5.280.0000.05320.90
5.5.270.0100.04720.88
5.5.260.0030.06320.87
5.5.250.0070.10020.61
5.5.240.0130.03720.01
5.5.230.0070.08020.26
5.5.220.0070.03720.24
5.5.210.0030.04320.05
5.5.200.0070.04320.01
5.5.190.0030.04720.26
5.5.180.0000.05020.21
5.5.160.0100.03320.15
5.5.150.0030.04320.20
5.5.140.0000.05320.18
5.5.130.0100.05020.17
5.5.120.0070.09020.28
5.5.110.0030.05320.16
5.5.100.0070.07320.19
5.5.90.0030.04020.11
5.5.80.0100.05720.12
5.5.70.0130.08020.16
5.5.60.0130.08720.17
5.5.50.0100.08020.18
5.5.40.0170.06720.16
5.5.30.0230.07020.07
5.5.20.0170.08019.98
5.5.10.0100.09719.98
5.5.00.0100.06720.04
5.4.450.0030.04719.41
5.4.440.0100.06019.39
5.4.430.0130.07719.17
5.4.420.0070.04019.13
5.4.410.0130.08019.05
5.4.400.0000.04318.97
5.4.390.0070.07019.17
5.4.380.0100.05018.86
5.4.370.0070.05019.14
5.4.360.0070.04019.09
5.4.350.0170.03319.17
5.4.340.0030.05319.07
5.4.320.0070.04318.95
5.4.310.0000.05019.05
5.4.300.0000.05318.98
5.4.290.0070.07718.95
5.4.280.0070.04319.17
5.4.270.0000.05018.84
5.4.260.0100.03719.05
5.4.250.0000.05718.98
5.4.240.0100.07319.05
5.4.230.0070.09318.85
5.4.220.0130.07719.00
5.4.210.0100.08719.13
5.4.200.0030.09018.97
5.4.190.0070.09018.84
5.4.180.0030.09319.05
5.4.170.0070.05319.02
5.4.160.0100.08018.97
5.4.150.0070.09018.82
5.4.140.0000.06316.36
5.4.130.0170.07716.34
5.4.120.0130.08016.36
5.4.110.0100.06716.46
5.4.100.0170.05016.36
5.4.90.0130.08016.39
5.4.80.0070.08716.38
5.4.70.0070.07316.30
5.4.60.0070.07316.45
5.4.50.0030.07716.27
5.4.40.0170.07016.32
5.4.30.0000.08716.32
5.4.20.0070.07316.35
5.4.10.0130.07016.39
5.4.00.0070.06715.71
5.3.290.0000.04314.50
5.3.280.0070.10014.39
5.3.270.0070.10014.61
5.3.260.0030.09314.57
5.3.250.0130.07714.41
5.3.240.0230.05714.45
5.3.230.0100.08714.56
5.3.220.0100.08014.36
5.3.210.0000.10014.46
5.3.200.0100.08714.51
5.3.190.0130.06714.50
5.3.180.0100.04714.54
5.3.170.0070.08714.41
5.3.160.0100.08714.49
5.3.150.0070.06714.47
5.3.140.0070.10014.36
5.3.130.0230.06714.45
5.3.120.0130.07314.55
5.3.110.0130.07314.48
5.3.100.0130.08314.01
5.3.90.0030.07713.95
5.3.80.0100.04713.88
5.3.70.0070.07313.96
5.3.60.0070.05013.82
5.3.50.0070.08313.87
5.3.40.0070.05713.71
5.3.30.0000.09713.73
5.3.20.0030.05713.50
5.3.10.0170.08713.52
5.3.00.0070.05713.58

preferences:
48.03 ms | 401 KiB | 5 Q