hallindavid / manny

a light-weight PHP package of useful common manipulators/formatters.
MIT License
37 stars 5 forks source link

Money value #15

Closed theoreaves closed 1 year ago

theoreaves commented 1 year ago

I need to take whatever number is entered and convert it to a money value. So: 457 would be 457.00, and 43.9 would be 43.90 and 44.5667 would be 44.57

How would I go about that?

Thanks!

hallindavid commented 1 year ago

These days, I'd actually just use the number_format function.

Manny doesn't have this one, because it's pretty clean as a built in php function.

$value = 44.5667

number_format($value,2);
theoreaves commented 1 year ago

You know, I was way overthinking it. Thanks!

hallindavid commented 1 year ago

No worries, Happy to help!