Skip to content

Instantly share code, notes, and snippets.

@PhiSYS
Created September 5, 2014 13:22
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 PhiSYS/505c924ad187e3dda151 to your computer and use it in GitHub Desktop.
Save PhiSYS/505c924ad187e3dda151 to your computer and use it in GitHub Desktop.
Swedish rounding for money values
/**
* Swedish rounding $nearest
*
* @param float $num
* @param float $nearest
* @return float
*/
function roundcent($num, $nearest = .05){ // default 5 cent
return round($num / $nearest) * $nearest;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment