Re: INT function?
| From: | James Taylor | Date: | Thu, 21 Feb 2002 01:16:54 +0000 |
| Subject: | Re: INT function? | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-85651@lists.php.net to get a copy of this message | ||
Heh, that's interesting.. Only difference is you have to put parenthesis
around int.
Weird
On Wednesday 20 February 2002 05:10 pm, you wrote:
> $z = (int)($x / $y); // should work
>
> or
>
> $z = $x / $y;
> settype($z, "integer");
>
> -----Original Message-----
> From: James Taylor [mailto:jtx@nestllc.com]
> Sent: Thursday, February 21, 2002 12:07 PM
> To: php-general@lists.php.net
> Subject: [PHP] INT function?
>
>
> Just curious what the function is to convert x into an integer if it's a
> float.... Say for example I have something like this
>
>
> $x = 7;
> $y = 3;
>
> $z = $x / $y;
>
> I want $z to equal 2. In perl it would be
>
> $z = int($x / $y);
>
> I'm just not sure how to do this in PHP, as int apparently doesn't work
> (darn). I'm using 4.06 by the way, so if there's some new function in 4.1
> that does this, I can't use it... so < 4.1 functions please