note 24546 deleted from language.types.type-juggling by tularis
| From: | tularis@php.net | Date: | Tue, 05 Jun 2007 09:50:04 +0000 |
| Subject: | note 24546 deleted from language.types.type-juggling by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-127226@lists.php.net to get a copy of this message | ||
Note Submitter: amittai at NOSPAMamittai dot com
----
Uneven division of an integer variable by another integer variable will result in a float by
automatic conversion -- you do not have to cast the variables to floats in order to avoid integer
truncation (as you would in C, for example):
$dividend = 2;
$divisor = 3;
$quotient = $dividend/$divisor;
print $quotient; // 0.66666666666667
Amittai Aviram