<?php
  $date 
= new DateTimeImmutable'2018-01-31 15:48:21' );
  echo 
$date->modify'next month' )->format'Y-m-d' ), "\n";
?>
Output
2018-03-03

Explanation:

2018-01-31 15:48:21

2018-02-31 15:48:21 "next month" increases month number by 1

2018-03-03 15:48:21 February only has 28 days, so days are overflown into the next month