gettype

gettype

gettype

gettype
It is used to get the type of a variable

Syntax:

string gettype ( mixed var)

It returns the data type of the given variable var.

Some of the possibles values for the returned string are:

“boolean”

“integer”

“double”

“string”

“array”

“object”

“resource”

“NULL”

“unknown type”

Example:

$input = array(1,2,3);

echo $type1 = gettype(”hello”);
echo $type2 = gettype(1);
echo $type3 = gettype(TRUE);
echo $type4 = gettype(2.3);
echo $type5 = gettype($input);

The result in $type1 is string.
The result in $type2 is integer.
The result in $type3 is boolean.
The result in $type4 is double.
The result in $type5 is array.

Leave a Reply


All material @ copyrighted by chrisranjana.com. If you want to link to this article you are welcome to do so. Unauthorized publication is strictly prohibited. This developer tutorial website contains articles by Php programmers , Software developers, Mysql programmers and asp c# programmers. This website also contains ajax tutorials and advanced mysql sql stored procedures and functions tutorials and sample codes.