English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
gettype() The function is used to get the type of a variable.
Note: Do not use gettype() To test a type, because the returned string may need to change in future versions. Moreover, since it includes string comparison, its execution is also slower. Use is_* Function alternative.
Version requirement: PHP 4, PHP 5, PHP 7
string gettype ( mixed $var )
Parameter description:
The returned string may be:
<?php echo gettype(102) . PHP_EOL; echo gettype(true) . PHP_EOL; echo gettype(' ') . PHP_EOL; echo gettype(null) . PHP_EOL; echo gettype(array()) . PHP_EOL; echo gettype(new stdclass()); ?>
The output result is:
integer boolean string NULL array object