intval

(FW >= 1.0)

intval- Get the integer value of a variable

Description

int intval ($var)
This function will return the integer equivalent of the variable $var

Parameters

$var - a string, int or float value

Return Value

The integer value of var on success, or 0 on failure. Empty arrays return 0, non-empty arrays return 1.

The maximum value is a signed integer range of -2147483648 to 2147483647.

Strings will most likely return 0 although this depends on the leftmost characters of the string. If the string is numeric it will be converted to an int.

Examples

<? 
$f = 1.05;
// converts the float $f into a variable $x which has a value of 1
$x = intval($f);
print("The integer value of ".$f." is ".$x); 
?>