Re: strange behavior, when converting float to int
| From: | Philip Thompson | Date: | Tue, 06 May 2008 14:34:25 +0000 |
| Subject: | Re: strange behavior, when converting float to int | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-273949@lists.php.net to get a copy of this message | ||
On May 6, 2008, at 1:38 AM, Maxim Antonov wrote:
Hi, all! Is this a bug? max@maximus:~$ /usr/bin/php 1.php 45 45 float(46) max@maximus:~$ /usr/bin/php -v PHP 5.3.0-dev (cli) (built: Apr 4 2008 11:37:33) Copyright (c) 1997-2008 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2008 Zend Technologies max@maximus:~$ cat 1.php <?php $i = 10.35 + 20.76 + 5.80 + 5.80 + 3.29; echo (int)$i; echo "\n"; echo intval($i); echo "\n"; var_dump($i); max@maximus:~$I got the same results. I'm not exactly sure what's happening, but I'd be curious to see if there's anyone else who can shed some light. PHP Version 5.2.4. ~Philip