PHP data types fall into three broad categories: scalar data types, compound data types, and special data types

Scalar data type

Type function Boolean The simplest data type with only two values: True/false String a string is a sequence of consecutive characters integer An integer contains all integers, which can be positive or negative. Float Float is also used to represent numbers, Unlike integers it can be used to represent decimals and exponents as well as integersCopy the code

Compound data type

Composite data types allow multiple data of the same type to be aggregated together and represented as a single entity item. Composite data types include arrays and objects

Special data type

In PHP, there are data types that are specifically used to provide services or data, which do not fall into any of the above standard data types and are therefore also referred to as special data types, including NULL and resource data types.

NULL is a special data type in PHP. It has only one value, NULL, which represents a NULL value (a variable has no value). Note that it has a different meaning than a space

The value of a variable is NULL if the following conditions are met: the variable is specified as a NULL value; The default value of a variable is NULL before it is assigned; When a variable is deleted using unset(), the value of the variable is also NULL.Copy the code

resources

A Resource is also a special data type in PHP. It mainly describes a PHP extension resource, such as a Database Query, an open file handle or a Database Connection, and extension types such as stream.

However, we cannot manipulate this variable type directly, only through specialized functions.