If you use more modern PHP, the following is based around actual days in each month:
$days = 151;
$start_date = new DateTime();
$end_date = (new $start_date)->add(new DateInterval("P{$days}D") );
$dd = date_diff($start_date,$end_date);
echo $dd->y." years ".$dd->m." months ".$dd->d." days";
Note that it will vary, depending on the current date, so you might prefer to set $start_date
and $end_date
to work from a fixed baseline
$days = 151;
$start_date = new DateTime('1970-01-01');
$end_date = (new DateTime('1970-01-01'))->add(new DateInterval("P{$days}D") );
$dd = date_diff($start_date,$end_date);
echo $dd->y." years ".$dd->m." months ".$dd->d." days";
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…