Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Rough replacement for cal_days_in_month for HHVM
if(!function_exists('cal_days_in_month')) {
function cal_days_in_month($calendar, $month, $year) {
return $month == 2 ? ($year % 4 ? 28 : ($year % 100 ? 29 : ($year % 400 ? 28 : 29))) : (($month - 1) % 7 % 2 ? 30 : 31);
}
if (!defined('CAL_GREGORIAN')) {
define('CAL_GREGORIAN', 1);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment