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

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.