Re: [PHP] INT function?

2002-02-20 Thread James Taylor

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:[EMAIL PROTECTED]]
> Sent: Thursday, February 21, 2002 12:07 PM
> To: [EMAIL PROTECTED]
> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] INT function?

2002-02-20 Thread bvr

On Thu, 21 Feb 2002 12:10:53 +1100, Martin Towell wrote:

>$z = (int)($x / $y);   // should work
>
>or
>
>$z = $x / $y;
>settype($z, "integer");

or

$z = intval($x / $y);


bvr.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] INT function?

2002-02-20 Thread Bas Jobsen

$z = intval($x / $y);

Op donderdag 21 februari 2002 02:06, schreef James Taylor:
> 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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP] INT function?

2002-02-20 Thread Michael Sims

At 05:06 PM 2/20/2002 -0800, James Taylor wrote:
>$x = 7;
>$y = 3;
>
>$z = $x / $y;
>
>I want $z to equal 2.  In perl it would be
>
>$z = int($x / $y);

This is untested, but:

$z = (int) ($x / $y);

Should work.


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




RE: [PHP] INT function?

2002-02-20 Thread Martin Towell

$z = (int)($x / $y);   // should work

or

$z = $x / $y;
settype($z, "integer");

-Original Message-
From: James Taylor [mailto:[EMAIL PROTECTED]]
Sent: Thursday, February 21, 2002 12:07 PM
To: [EMAIL PROTECTED]
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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[PHP] INT function?

2002-02-20 Thread James Taylor

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

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php