PHP function gettype()

Availability in PHP 4.0

Returns the type of the variable.

Parameters

Parameter Data type Default value Note
$var mixed not Variable to check

Return values

string

Returns the type of the variable.

Returns one of the following:

  • boolean
  • integer
  • double (for historical reasons, double is returned instead of float, based on the C implementation of PHP, which uses double)
  • string
  • array
  • object
  • resource
  • NULL
  • unknown type (unknown type)

Other resources

Official gettype documentation

Newsletter

Nejlepsi tipy a triky o PHP do Vaseho e-mailu. Clanky a novinky nejen ze sveta PHP a programovani.