Skip to content

Commit

Permalink
Avoid round issues on Util::amountInCents
Browse files Browse the repository at this point in the history
  • Loading branch information
mathmarques committed Sep 9, 2019
1 parent 2fa3905 commit 9eceef6
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/Util.php
Expand Up @@ -37,7 +37,7 @@ public static function cleanArray(?array &$array): ?array
*/
public static function amountInCents(?float $amount): int
{
return $amount ? intval($amount * 100) : 0;
return $amount ? intval(number_format($amount, 2, '', '')) : 0;
}

/**
Expand Down

0 comments on commit 9eceef6

Please sign in to comment.