Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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