What are some alternatives to the strtotime function for calculating the next month in PHP?

The strtotime function in PHP is commonly used to calculate dates and times based on a given string representation. However, if you need to calculate the next month without relying on strtotime, you can use the DateTime class along with DateInterval to achieve the desired result.

$currentDate = new DateTime();
$currentDate->modify('first day of next month');
$nextMonth = $currentDate->format('Y-m-d');
echo $nextMonth;