3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo diffMonth("202407", "202408"); function diffMonth($month_A, $month_B) { // Extract year and month components $year_A = intval(substr($month_A, 0, 4)); $month_A = intval(substr($month_A, 4, 2)); $year_B = intval(substr($month_B, 0, 4)); $month_B = intval(substr($month_B, 4, 2)); // Calculate month difference $difference = ($year_A - $year_B) * 12 + ($month_A - $month_B); // Ensure positive difference return $difference; }

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.5.10.0090.00916.77
8.5.00.0120.01021.76
8.4.150.0010.00214.05
8.4.140.0110.01017.40
8.4.130.0120.00717.75
8.4.120.0080.01020.51
8.4.110.0140.00522.39
8.4.100.0130.00717.69
8.4.90.0130.00817.59
8.4.80.0050.00517.70
8.4.70.0100.00919.38
8.4.60.0110.01018.59
8.4.50.0150.00717.79
8.4.40.0070.01317.55
8.4.30.0150.00020.64
8.4.20.0090.01219.57
8.4.10.0000.00819.37
8.3.280.0110.01118.29
8.3.270.0130.00716.54
8.3.260.0110.00816.42
8.3.250.0050.00918.96
8.3.240.0090.00916.50
8.3.230.0060.00416.80
8.3.220.0050.00217.26
8.3.210.0100.00716.41
8.3.200.0050.00416.44
8.3.190.0060.00216.97
8.3.180.0080.01017.20
8.3.170.0120.00418.86
8.3.160.0040.00820.78
8.3.150.0090.00917.08
8.3.140.0150.00416.70
8.3.130.0090.00018.40
8.3.120.0130.00018.81
8.3.110.0060.00319.97
8.3.100.0420.00937.54
8.3.90.0200.00237.54
8.3.80.0270.00437.54
8.3.70.0270.01237.54
8.3.60.0130.01037.54
8.3.50.0290.01237.54
8.3.40.0320.00037.54
8.3.30.0360.00337.54
8.3.20.0290.00437.54
8.3.10.0200.02037.54
8.3.00.0340.01037.54
8.2.290.0110.00820.21
8.2.280.0110.00818.25
8.2.270.0060.01316.64
8.2.260.0090.00016.43
8.2.250.0060.00316.57
8.2.240.0110.00718.97
8.2.230.0050.00220.94
8.2.220.0320.00637.54
8.2.210.0320.00637.54
8.2.200.0350.00937.54
8.2.190.0350.00737.54
8.2.180.0330.00337.54
8.2.170.0310.00637.54
8.2.160.0320.00437.54
8.2.150.0250.01437.54
8.2.140.0250.01237.54
8.2.130.0300.01337.54
8.2.120.0320.00737.54
8.2.110.0290.01537.54
8.2.100.0400.00037.54
8.2.90.0280.00037.54
8.2.80.0310.00337.54
8.2.70.0430.00037.54
8.2.60.0270.00037.54
8.2.50.0420.01237.54
8.2.40.0330.00737.54
8.2.30.0320.00037.54
8.2.20.0350.00637.54
8.2.10.0290.01637.54
8.2.00.0300.01137.54
8.1.330.0120.00718.52
8.1.320.0120.00716.04
8.1.310.0070.01116.20
8.1.300.0040.00418.41
8.1.290.0320.00637.54
8.1.280.0380.00337.54
8.1.270.0380.00037.54
8.1.260.0300.01537.54
8.1.250.0420.01137.54
8.1.240.0280.01237.54
8.1.230.0350.00837.54
8.1.220.0240.01237.54
8.1.210.0230.00337.54
8.1.200.0190.00937.54
8.1.190.0150.00637.54
8.1.180.0200.01037.54
8.1.170.0310.00637.54
8.1.160.0280.00737.54
8.1.150.0240.01637.54
8.1.140.0350.00737.54
8.1.130.0260.01337.54
8.1.120.0330.00737.54
8.1.110.0300.01037.54
8.1.100.0330.00637.54
8.1.90.0320.00737.54
8.1.80.0240.01537.54
8.1.70.0310.00937.54
8.1.60.0330.00937.54
8.1.50.0390.00337.54
8.1.40.0360.00337.54
8.1.30.0310.01237.54
8.1.20.0330.01137.54
8.1.10.0460.00037.54
8.1.00.0340.00737.54

preferences:
69.17 ms | 403 KiB | 5 Q