Skip to content

Instantly share code, notes, and snippets.

@AshleyPinner
Created October 7, 2014 11:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AshleyPinner/f2230ae8307e2f05149c to your computer and use it in GitHub Desktop.
Save AshleyPinner/f2230ae8307e2f05149c to your computer and use it in GitHub Desktop.
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