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
$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
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:
$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 =
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
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
6 matches
Mail list logo