Php 从现在起的第25天

Php 从现在起的第25天,php,datetime,Php,Datetime,我需要一个简单的方法从当前日期获得下一个25日 示例:如果日期是12/2,我需要得到25/2。如果日期为25/2或28/2,则返回日期为25/3。我正在使用php日期时间 我一直在尝试使用以下几种不同的方法: $now = new DateTime("now"); $date = new DateTime("first day of this month"); $date->modify("+25 day"); if($now->format("d") >= 25){

我需要一个简单的方法从当前日期获得下一个25日

示例:如果日期是12/2,我需要得到25/2。如果日期为25/2或28/2,则返回日期为25/3。我正在使用php日期时间

我一直在尝试使用以下几种不同的方法:

 $now = new DateTime("now");
 $date = new DateTime("first day of this month");
 $date->modify("+25 day");

 if($now->format("d") >= 25){
     $date->modify("+1 month");
 }
这个代码有效。但一定有更简单的方法。。。有人有更简单的解决方案吗

我在找类似的东西(或类似的东西)

适用于PHP5.4及以上版本

$date = new DateTime( 
    (((new DateTime())->format('d') > 25) ? "next" : "this") . 
    " month + 24 days"
);
echo $date->format('Y-m-d');
$date = new DateTime( 
    (((new DateTime())->format('d') > 25) ? "next" : "this") . 
    " month + 24 days"
);
echo $date->format('Y-m-d');