note 36586 deleted from language.operators.arithmetic by didou
| From: | didou@php.net | Date: | Wed, 15 Oct 2003 17:24:18 +0000 |
| Subject: | note 36586 deleted from language.operators.arithmetic by didou | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-58644@lists.php.net to get a copy of this message | ||
Note Submitter: tristan@pc-seller.com
----
to do a integer divide
$a = 5;
$b = 3;
$a / $b = 1.66666;
wheras we want:
$a / $b = 1;
and
$a % $b = 2; (Modulus)
the answer I find is to do:
$integer_divide = floor($a/$b);
which bascially removes anything after the decimal point.
AFAIK, there is no proper function for this, odd considering there is a modulus function.