#48496 [Opn]: String to numerical conversion
| From: | rquadling@php.net | Date: | Mon, 08 Jun 2009 14:55:11 +0000 |
| Subject: | #48496 [Opn]: String to numerical conversion | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-2353@lists.php.net to get a copy of this message | ||
ID: 48496
Updated by: rquadling@php.net
Reported By: headden at karelia dot ru
Status: Open
Bug Type: Documentation problem
Operating System: Irrelevant
PHP Version: Irrelevant
New Comment:
As 1234567890123 is larger than a 32bit integer, it is converted to a
float.
Once in a float it is quite happily allowed to be incremented as you
are
using.
Previous Comments:
------------------------------------------------------------------------
[2009-06-08 14:31:10] headden at karelia dot ru
Description:
------------
http://www.php.net/manual/en/language.types.string.php
"The string will be evaluated as a float if it contains any of the
characters '.', 'e', or 'E'. Otherwise, it will be evaluated as an
integer."
this statement is wrong, consider the following code:
$a = 1 + "1234567890123";
var_dump($a); // outputs 'float(1234567890124)' on a 32-bit platform
this means that "1234567890123" was treated as 'float' although it does
not have any of '.', 'e' or 'E' characters.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48496&edit=1