How can conditional statements be structured to handle edge cases such as the current month being December in the context of the provided code?

To handle edge cases such as the current month being December in the context of the provided code, you can add an additional condition to check if the current month is December. If it is December, you can reset the month to January of the next year. This ensures that the month is correctly incremented and the year is updated accordingly.

$currentMonth = date('m');
$currentYear = date('Y');

if ($currentMonth == 12) {
    $currentMonth = 1;
    $currentYear++;
} else {
    $currentMonth++;
}

echo "Next month: " . $currentMonth . "/" . $currentYear;