Re: key arrays should be integers when they are not what's happening exactly?
| From: | Negin Nickparsa | Date: | Mon, 21 Jul 2014 22:25:18 +0000 |
| Subject: | Re: key arrays should be integers when they are not what's happening exactly? | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-323639@lists.php.net to get a copy of this message | ||
Thank you
Sincerely
Negin Nickparsa
On Sun, Jul 20, 2014 at 11:07 PM, David Harkness <david.h@highgearmedia.com>
wrote:
> 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
>
>