Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

PHP gettype() Function

PHP gettype() Function

PHP Available FunctionsAvailable PHP Functions

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:

Return Value

Returns a string; possible values are:

Example

Example

The output is:


integer
boolean
string
NULL
array
object

PHP Available FunctionsAvailable PHP Functions