Skip to content

Instantly share code, notes, and snippets.

@vidalon
Created November 24, 2011 18:13
Show Gist options
  • Save vidalon/1391959 to your computer and use it in GitHub Desktop.
Save vidalon/1391959 to your computer and use it in GitHub Desktop.
Rounding up expires param on PHP
$roundup = 15 * 60; //Roundup time in seconds, 15 minutes
//Round up the expires time to 15 minutes unless otherwise specified
if (!array_key_exists('expires', $params)) {
$params['expires'] = (floor(time()/$roundup) * $roundup) + $roundup;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment