This article introduces to you about the eight types of data in PHP summary introduction, there is a certain reference value, the need for friends can refer to, I hope to help you.
PHP supports a total of eight data types, including 4 scalar types, Boolean (Boolean), Integer (Shape), float/double (floating point), and string (string type), two composite types, array (arrays), and object ; Two special types, resource (resources) and bull.
One, scalar data types
1. Boolean Type (Boolean)
Boolean is one of the more commonly used data types in PHP, which holds a value of true or FALSE, where true and false are the internal keywords of PHP. To set a Boolean variable, simply assign True or FALSE to the variable. In PHP, not only the Boolean value is false, in some special cases the non-Boolean value is also considered false. For example, 0, an empty string, and an array that only declares no assignment.
2. String type
A string is a sequential sequence of strings, consisting of numbers, letters, and symbols. Each character in a string occupies only one byte. A way to define a string of three types, single quotes, double quotes, and delimiters (<<<)
The variables contained in the anti-quotation marks are output by ordinary characters, such as $i = ' I'm the most handsome ', echo ' $i ' will output $i and double quotes will parse the variable output "I'm the most handsome"!
3. Integral type (integer)
An integer data type can contain only integers, and in a 32-bit operating system, the range of valid values is -2147483648~+2147483647.
4. Float type (float)
Floating-point data types can be used to store integers, or to store integers, or to store decimals.
Composite data types
1. Arrays (Array)
An array is a set of data that organizes a series of data into a single, actionable whole. The array can include many data, such as scalar data, arrays, objects, resources, and other syntactic structures supported in PHP. Each data in an array is called an element, and the element consists of an index (key name) and a value of two parts. The index of an element can consist of a number or a string, and the value of an element can be multiple data types.
Define the syntax format for the data:
$array = (' value1 ', ' value2 ' ... ) $array [' key '] = ' value '
2. Objects (object)
And now I don't know what to call a target.
Special resource types
Resource (Resource) null value (NULL)