ID: 39703
Updated by: [EMAIL PROTECTED]
Reported By: arjen at parse dot nl
-Status: Open
+Status: Closed
Bug Type: Documentation problem
Operating System: Linux
PHP Version: Irrelevant
New Comment:
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation
better.
Previous Comments:
------------------------------------------------------------------------
[2007-04-23 11:20:28] tayloj1 at uk dot ibm dot com
Ref: "The division operator ("/") returns a float value anytime, even
if the two operands are integers (or strings that get converted to
integers)."
The word "anytime" is ambiguous. If "anytime" means "always" in this
context, the statement is not true as the following testcase shows:
<?php
$a = 4;
$b = 2;
$c = $a / $b;
var_dump($a, $b, $c);
?>
Actual Output:
int(4)
int(2)
int(2)
Expected Output (if what the manual says were true) :
int(4)
int(2)
float(2)
Also noting user comment from justin at koivi dot com, 25-Jan-2005,
suggest the existing sentence is replaced with the following text:
"The division operator "/" returns a float value unless the two
operands are integers (or strings that get converted to integers) and
the numbers are evenly divisible, in which case an integer value will be
returned."
------------------------------------------------------------------------
[2006-12-01 14:06:46] arjen at parse dot nl
Description:
------------
http://www.php.net/manual/en/language.operators.arithmetic.php
"The division operator ("/") returns a float value anytime, even if the
two operands are integers (or strings that get converted to integers)."
Anytime like 'always' or 'it might be possible the division operator
returns a float, even if the operands are integers'?
Reproduce code:
---------------
<?php
echo gettype(10/2);
?>
Expected result:
----------------
float
Actual result:
--------------
integer
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=39703&edit=1