3v4l.org

run code in 300+ PHP versions simultaneously
<?php // Function 0 & 1 function monthsBetween(DateTime $date1, DateTime $date2 = NULL) { if (is_null($date2)) { $date2 = new DateTime("now"); } $interval = $date2->diff($date1); return 12 * $interval->y + $interval->m; } // Function 2 & 3 function hasMonthBetween(DateTime $date1, DateTime $date2 = NULL) { return monthsBetween($date1, $date2) > 0; } $startDate = new DateTime('2000-01-11'); $endDate = new DateTime('2000-02-11'); // Function 0 Call echo monthsBetween($startDate, $endDate) . PHP_EOL; // Function 1 Call echo monthsBetween($startDate) . PHP_EOL; // Function 2 Call echo hasMonthBetween($startDate, $endDate) . PHP_EOL; // Function 3 Call echo hasMonthBetween($startDate) . PHP_EOL;

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.4.120.0110.00920.52
8.4.110.0100.00822.27
8.4.100.0100.01218.32
8.4.90.0100.00718.15
8.4.80.0060.00218.30
8.4.70.0120.01018.32
8.4.60.0090.01218.28
8.4.50.0110.00818.87
8.4.40.0160.00617.77
8.4.30.0030.00518.92
8.4.20.0070.01418.06
8.4.10.0080.00019.69
8.3.250.0120.00618.74
8.3.240.0140.00616.65
8.3.230.0030.00516.77
8.3.220.0080.01019.29
8.3.210.0090.00616.76
8.3.200.0160.00416.86
8.3.190.0120.00816.75
8.3.180.0130.00816.57
8.3.170.0000.00818.92
8.3.160.0110.00720.13
8.3.150.0100.01016.82
8.3.140.0060.00316.94
8.3.130.0060.00318.54
8.3.120.0060.00320.86
8.3.110.0030.01620.94
8.3.100.0130.00616.78
8.3.90.0090.01218.59
8.3.80.0090.00018.68
8.3.70.0100.01016.63
8.3.60.0140.00018.54
8.3.50.0110.00318.36
8.3.40.0090.00922.09
8.3.30.0100.00319.23
8.3.20.0060.00324.18
8.3.10.0150.00424.66
8.3.00.0070.00726.16
8.2.290.0100.00920.41
8.2.280.0080.01318.47
8.2.270.0150.00317.17
8.2.260.0140.00418.37
8.2.250.0060.01016.75
8.2.240.0030.00617.43
8.2.230.0100.01022.58
8.2.220.0030.00624.06
8.2.210.0120.00326.77
8.2.200.0100.00018.31
8.2.190.0120.00317.11
8.2.180.0180.00418.64
8.2.170.0100.01019.01
8.2.160.0130.00722.96
8.2.150.0120.00625.66
8.2.140.0030.00524.66
8.2.130.0070.00026.16
8.2.120.0110.00720.64
8.2.110.0000.01019.21
8.2.100.0060.00617.75
8.2.90.0200.00917.50
8.2.80.0300.00017.88
8.2.70.0200.00417.63
8.2.60.0240.00717.50
8.2.50.0230.00717.50
8.2.40.0230.00317.50
8.2.30.0170.01017.50
8.2.20.0060.00617.88
8.2.10.0230.00717.38
8.2.00.0220.00617.48
8.1.330.0120.00716.48
8.1.320.0100.01216.39
8.1.310.0060.00318.38
8.1.300.0060.01218.50
8.1.290.0060.00318.88
8.1.280.0040.01225.92
8.1.270.0080.00024.66
8.1.260.0050.00326.35
8.1.250.0090.00928.09
8.1.240.0050.00522.80
8.1.230.0230.00417.38
8.1.220.0200.00617.60
8.1.210.0210.00517.25
8.1.200.0270.00017.38
8.1.190.0180.00917.25
8.1.180.0240.00317.36
8.1.170.0180.00917.25
8.1.160.0250.00317.50
8.1.150.0220.00517.35
8.1.140.0270.00017.34
8.1.130.0270.00017.25
8.1.120.0290.00017.63
8.1.110.0180.00917.35
8.1.100.0260.00017.35
8.1.90.0180.00717.35
8.1.80.0110.01517.38
8.1.70.0220.00317.48
8.1.60.0200.01017.35
8.1.50.0190.00617.25
8.1.40.0160.01017.35
8.1.30.0240.00317.48
8.1.20.0130.01317.63
8.1.10.0240.00317.48
8.1.00.0240.00517.50
8.0.300.0210.00616.72
8.0.290.0180.00916.87
8.0.280.0180.00717.00
8.0.270.0230.00616.99
8.0.260.0220.00616.88
8.0.250.0170.01016.88
8.0.240.0190.00817.13
8.0.230.0240.00317.00
8.0.220.0220.00716.63
8.0.210.0240.00316.88
8.0.200.0180.01016.87
8.0.190.0270.00016.62
8.0.180.0270.00016.71
8.0.170.0160.01016.88
8.0.160.0220.00516.75
8.0.150.0270.00016.99
8.0.140.0280.00016.74
8.0.130.0200.00716.75
8.0.120.0280.00016.63
8.0.110.0270.00016.75
8.0.100.0210.00816.88
8.0.90.0270.00017.00
8.0.80.0240.00416.75
8.0.70.0230.00616.63
8.0.60.0250.00316.74
8.0.50.0280.00016.75
8.0.30.0260.00516.84
8.0.20.0240.00416.61
8.0.10.0200.00816.88

preferences:
24.4 ms | 403 KiB | 5 Q