The gettype function returns a string that describes the type of the variable or
expression. It will be one of the following values: array, class, double, integer,
object, resource, string, unknown type.
<?
//integer
printf("%s
\n", gettype(11));
//double
printf("%s
\n", gettype(7.3));
//string
printf("%s
\n", gettype("hello"));
?>
integer intval(expression, integer base)
The intval function returns its argument as an integer. The optional base argument
instructs intval to use a numerical base other than ten.
Chapter 2 discusses converting between types.
<?
//drop extraneous stuff after decimal point
print(intval("13.5cm"). "
\n");
//convert from hex
print(intval("EE", 16));
?>
boolean is_array(expression)
The is_array function returns TRUE if the expression is an array, otherwise FALSE is
returned.
<?
$colors = array("red", "blue", "green");
if(is_array($colors))
{
print("colors is an array");
}
?>