This article lists common data types in PHP. if you are interested, refer to PHP Data types.
PHP supports eight primitive types ).
Four scalar types:
String (string)
Integer)
Float (float, also double)
Boolean (boolean)
Two composite types:
Array)
Object)
Two special types:
Resource)
NULL)
View variable types
The gettype () function allows you to conveniently view the type of a variable:
The code is as follows:
(PS: T good php q buckle: 276167802, verification: csl)
Prompt
For historical reasons, for float data, the gettype () function returns double instead of float.
To view the value and type of an expression, use the var_dump () function.
Judge variable type
To determine the next logical action by determining the variable type, use the is_type series functions instead of gettype:
The code is as follows:
The above is a summary of the PHP Data types in this article. I hope this article will help the majority of php developers. thank you for reading this article.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.