fork(3) download
format('t') - $bd->format('d') + 1;
$pass = false;

while($bd->format('Y') < $ed->format('Y')
        || $bd->format('n') < $ed->format('n')) {
    $bd->modify("+1 month");
    echo $c." ";
    $c = $bd->format('t');
    $pass = true;
}
$c = $ed->format('d');
if(!$pass)
    $c -= $bd->format('d') - 1;
echo $c;
?>
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
13 31 22