fork(3) download
  1. <?php
  2. $begintime = '2012-12-19';
  3. $endtime = '2013-02-22';
  4. $bd = new DateTime($begintime);
  5. $ed = new DateTime($endtime);
  6.  
  7. $c = $bd->format('t') - $bd->format('d') + 1;
  8. $pass = false;
  9.  
  10. while($bd->format('Y') < $ed->format('Y')
  11. || $bd->format('n') < $ed->format('n')) {
  12. $bd->modify("+1 month");
  13. echo $c." ";
  14. $c = $bd->format('t');
  15. $pass = true;
  16. }
  17. $c = $ed->format('d');
  18. if(!$pass)
  19. $c -= $bd->format('d') - 1;
  20. echo $c;
  21. ?>
Success #stdin #stdout 0.02s 13112KB
stdin
Standard input is empty
stdout
13 31 22