[php-src] Issue #8028: Problem with casting into (int) or intval()
| From: | iluuu1994 | Date: | Thu, 03 Feb 2022 16:14:17 +0000 |
| Subject: | [php-src] Issue #8028: Problem with casting into (int) or intval() | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239452@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8028
Comment Author: iluuu1994
@VILQ Yes.
round() rounds up or down, (int) $foo always rounds down.
echo rounds to the php.ini precision setting.
https://3v4l.org/JWAMR#v8.1.2
```php
$x = 0.1 + 0.2;
var_dump($x);
echo $x. "\n";
ini_set('precision', -1);
echo $x, "\n";
```
```log
float(0.30000000000000004)
0.3
0.30000000000000004
```