PHP data types
PHP supports eight primitive types (types).
Four scalar types:
string (string)
integer (integer) float (floating point type, also called double) boolean (Boolean)
Two composite types:
array (array)
object (object)
Two special types Type:
resource (resource)
NULL (empty)
View variable type
You can easily view a variable through the gettype() function Type:
Tips
Due to historical reasons, if it is float type data, the gettype() function returns It's double, not float. If you want to see the value and type of an expression, please use the var_dump() function. Judge the variable type
If you want to determine the next logical action by judging the variable type, do not use gettype(), but use the is_type series of functions:
< ;?php$var_int = 12; // If $var_int is int type, this is added if (is_int($var_int)) { $var_int = $var_int+4;}echo $var_int; // Output 16?>
http://www.bkjia.com/PHPjc/447016.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/447016.htmlTechArticlePHP data types PHP supports eight primitive types (types). Four scalar types: string (string) integer (integer) float (floating point type, also called double) boolean (Boolean type)...