Re: key arrays should be integers when they are not what's happening exactly?
| From: | David Harkness | Date: | Mon, 21 Jul 2014 06:07:06 +0000 |
| Subject: | Re: key arrays should be integers when they are not what's happening exactly? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323637@lists.php.net to get a copy of this message | ||
On Sun, Jul 20, 2014 at 5:22 PM, Negin Nickparsa <nickparsa@gmail.com>
wrote:
> how PHP rounds the numbers in this case ?
>
It doesn't use the built-in round function but rather casts the floats to
int. You can achieve the same effect with the intval function and casting.
> echo intval(1.5);
1
> echo (int) 1.5;
1
Peace,
David