Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #16425 > unrolled thread

casting to integer

Started bybill <william@TechServSys.com>
First post2016-02-15 08:14 -0500
Last post2016-02-16 06:47 -0500
Articles 4 — 2 participants

Back to article view | Back to comp.lang.php


Contents

  casting to integer bill <william@TechServSys.com> - 2016-02-15 08:14 -0500
    Re: casting to integer: solved bill <william@TechServSys.com> - 2016-02-15 08:16 -0500
    Re: casting to integer Arno Welzel <usenet@arnowelzel.de> - 2016-02-15 18:08 +0100
      Re: casting to integer bill <william@TechServSys.com> - 2016-02-16 06:47 -0500

#16425 — casting to integer

Frombill <william@TechServSys.com>
Date2016-02-15 08:14 -0500
Subjectcasting to integer
Message-ID<n9siuu$1sl3$1@gioia.aioe.org>
I know it must be really simple, but I can't find it in the docs.

How does one cast a float to an integer?
I tried round and floor but both leave var as float, although 
with a float approximation of an integer.

This is for comparison.

bill

[toc] | [next] | [standalone]


#16426 — Re: casting to integer: solved

Frombill <william@TechServSys.com>
Date2016-02-15 08:16 -0500
SubjectRe: casting to integer: solved
Message-ID<n9sj36$1sl3$2@gioia.aioe.org>
In reply to#16425
On 2/15/2016 8:14 AM, bill wrote:
> I know it must be really simple, but I can't find it in the docs.
>
> How does one cast a float to an integer?
> I tried round and floor but both leave var as float, although
> with a float approximation of an integer.
>
> This is for comparison.
>
> bill

of course, just as soon as I sent the request for help, I found 
the answer: intval

bill

[toc] | [prev] | [next] | [standalone]


#16428

FromArno Welzel <usenet@arnowelzel.de>
Date2016-02-15 18:08 +0100
Message-ID<56C2061F.9060805@arnowelzel.de>
In reply to#16425
bill schrieb am 2016-02-15 um 14:14:

> I know it must be really simple, but I can't find it in the docs.
> 
> How does one cast a float to an integer?

<http://php.net/manual/de/language.types.type-juggling.php>

$y = (int)$x;



-- 
Arno Welzel
http://arnowelzel.de
http://de-rec-fahrrad.de
http://fahrradzukunft.de

[toc] | [prev] | [next] | [standalone]


#16432

Frombill <william@TechServSys.com>
Date2016-02-16 06:47 -0500
Message-ID<n9v28l$1o5p$1@gioia.aioe.org>
In reply to#16428
On 2/15/2016 12:08 PM, Arno Welzel wrote:
> bill schrieb am 2016-02-15 um 14:14:
>
>> I know it must be really simple, but I can't find it in the docs.
>>
>> How does one cast a float to an integer?
>
> <http://php.net/manual/de/language.types.type-juggling.php>
>
> $y = (int)$x;
>
>
>
Thank you Amos.  Fascinating reading.  I knew it must be there 
somewhere.

bill

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web