The gettype() function is used to get the type of a variable.
Note : Do not use gettype() to test a type, as the string it returns may need to change in future versions. In addition, it runs slower due to the inclusion of string comparisons. Use
is_*
functions instead.
Version requirements: PHP 4, PHP 5, PHP 7
string gettype (mixed $var)
Parameter description:
$var: variable.
Returns a string. Possible values are:
boolean
integer
double
string
array
object
resource
NULL
unknown type
The output is:
integerbooleanstringNULLarrayobject