Jump to content

A question regarding round()


Cep

Recommended Posts

Hello,

 

My question is to do with the php round function. From what I can glean the function should round up or down to the nearest integer.

 

So

4.3 will be 4,

4.4 till be 4,

4.5 will be 5.

 

However I have come across occasions where values that are for example 0.375 are being rounded to 0.37 and not 0.38. Is this because in the optional parameter I am doing,

 

$mynum = round($num, 2);

Link to comment
https://forums.phpfreaks.com/topic/81653-a-question-regarding-round/
Share on other sites

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.