Jump to content

Using Ceiling or Round function for decimals places


theITvideos

Recommended Posts

Hi there.

 

I am trying to display numbers if they have the numbers like:

 

number_format($price,2)

 

This gives us two decimal places i.e 7.23

 

Now thats fine, I would like to round the last two decimal places. I would like to make it 7.25, (rounding it from 7.23 to 7.25)

 

Similarly making:

 

12.44 to 12.45

33.18 to 33.20

52.13 to 52.15

 

So actually rounding the last two places. Coz obviously customers won't be able to pay 52 dollars 13 cents. So therefore rounding the last cent's (decimal part) making it to 52.15

 

Thank you.

 

All comments and feedback are welcomed. :)

 

 

(d

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.