YouTip LogoYouTip

Php Gettype Function

# PHP gettype() Function [![Image 3: PHP Available Functions](#)PHP Available Functions](#) The **gettype()** function is used to get the type of a variable. > **Note**: Do not use **gettype()** to test for a certain type, as the string it returns may change in future versions. Additionally, it is slower due to string comparisons. Use the is_* functions instead. Version Requirement: PHP 4, PHP 5, PHP 7 ### Syntax string gettype ( mixed $var ) Parameter Description: * $var: The variable. ### Return Value Returns a string, which may be one of the following values: * boolean * integer * double * string * array * object * resource * NULL * unknown type ### Example ## Example The output will be: integer booleanstring NULL array object [![Image 4: PHP Available Functions](#)PHP Available Functions](#)
← Php Is_Bool FunctionPhp Floatval Function β†’