PHP gettype() Function

PHP gettype() Function


The gettype() function is an inbuilt function in PHP which is used to get the type of a variable. It is used to check the type of existing variable.

Syntax:

string gettype ( $var )

Parameter: This function accepts a single parameter $var. It is the name of variable which is needed to be checked for type of variable.

Return Value: This function returns a string type value. Possible values for the returned string are:

  • boolean
  • integer
  • double (for historical reasons “double” is returned in case of float)