We Recommend

Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems Wicked Cool PHP: Real-World Scripts That Solve Difficult Problems
Wicked Cool PHP contains a wide variety of scripts to process credit cards, check the validity of email addresses, template HTML, and serve dynamic images and text.


Posted By

damarev on 10/03/08


Tagged


Versions (?)


getMonthDays


Published in: PHP 


  1. function getMonthDays($Month, $Year)
  2. {
  3. //Si la extensión que mencioné está instalada, usamos esa.
  4. if( is_callable("cal_days_in_month"))
  5. {
  6. return cal_days_in_month(CAL_GREGORIAN, $Month, $Year);
  7. }
  8. else
  9. {
  10. //Lo hacemos a mi manera.
  11. return date("t",mktime(0,0,0,$Month,1,$Year));
  12. }
  13. }
  14. //Obtenemos la cantidad de días que tiene septiembre del 2008
  15. echo getMonthDays(9, 2008);

Report this snippet 

You need to login to post a comment.