PHP data type
PHP supports eight primitive types (type).
Four types of scalar:
String (String)
Integer (integer type)
Float (floating point type, also double)
Boolean (Boolean)
Two kinds of composite types:
Array (arrays)
Object (Objects)
Two special types:
Resource (resources)
Null (empty)
View variable types
The GetType () function makes it easy to see the type of a variable:
Tips
For historical reasons, if the data is float type, the GetType () function returns a double instead of float.
If you want to see the value and type of an expression, use the Var_dump () function.
Judging variable types
If you want to determine the next logical action by judging the variable type, do not use GetType () and use the Is_type series function:
!--? php$var_int = 12;//if $var _int is of type int, this is an addition if (Is_int ($var _int)) {$var _int = $var _int+4;} echo $var _int;//output?-->
http://www.bkjia.com/phpjc/ 447016.html www.bkjia.com true http://www.bkjia.com/phpjc/447016.html techarticle php Data type PHP supports eight primitive types (type). Four scalar types: string (String) integer (integer) float (floating-point, also Double) Boolean (Boolean) ...