strange behavior, when converting float to int

[email protected] (Maxim Antonov)
Newsgroups php.general
Message-ID <[email protected]>
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:~$
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.