RE: Re[2]: [PHP] Math Question
| From: | Jay Blanchard | Date: | Wed, 11 Feb 2004 14:24:48 +0000 |
| Subject: | RE: Re[2]: [PHP] Math Question | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-177384@lists.php.net to get a copy of this message | ||
[snip]
VJ> Seems to me you need
VJ> floor($number1 / $number2)
Only if you always want to round *down* the equation. For example
flooring a result of 4.99 will give you an integer of 4 whereas
round() (or ceil()) will give you 5. It depends on the situation as to
which is most useful.
[/snip]
you can also try number_format($a / $b, 0, '', '');
and test for the result as some rounding does occur. (I prbably have the
syntax wrong this AM)