PHP gettype() Function
gettype() The function is used to get the type of a variable.
Note: Do not use gettype() to test a certain type, because the string it returns may change in future versions. In addition, since it includes string comparison, it runs more slowly. Use is_* function instead.
Version requirement: PHP 4, PHP 5, PHP 7
Syntax
string gettype ( mixed $var )
Parameter Description:
- $var: variable.
Return Value
Returns a string; possible values are:
- boolean
- integer
- double
- string
- array
- object
- resource
- NULL
- unknown type
Example
Example
The output is:
integer
boolean
string
NULL
array
object
Available PHP Functions