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:
resource (resource)
NULL (empty)
View variable type
You can easily check the type of a variable through the gettype() function:
Copy code The code is as follows :
(PS: T good PHP Q buckle: 276167802, verification: csl)
Tips
Due to historical reasons, if it is float type data, the gettype() function returns double instead of 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:
Copy code The code is as follows:
The above is a summary of PHP data types in this article. I hope this article will be useful to the majority of PHP developers. Help, thank you for reading this article.
http://www.bkjia.com/PHPjc/676919.htmlwww.bkjia.comtruehttp: //www.bkjia.com/PHPjc/676919.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)...
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn