Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Formatting issue with values between 10 and 99 #3

Open
sethington opened this issue Mar 6, 2015 · 0 comments
Open

Formatting issue with values between 10 and 99 #3

sethington opened this issue Mar 6, 2015 · 0 comments

Comments

@sethington
Copy link

$money = new Money(97,new BCMathProvider());
echo $money->format('');

Yields 0.097 instead of 0.97

Looks like the issue with the use of str_pad, as str_pad('0',0) will still output a 0.

https://github.com/Lusitanian/PHPMoney/blob/master/src/PHPMoney/Money.php#L48

str_pad($value, 2, '0', STR_PAD_LEFT) might be a solution here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant