PHP string
You can put any text in single and double quotes;
Single quotes do not parse variables, double quotes parse variables
PHP integer
An integer is a number without decimals.
Integer rules:
Integer must have at least one digit (0-9)
Integers cannot contain commas or spaces
Integers have no decimal point
Integers can be positive or negative
Integers can be specified in three formats: decimal, hexadecimal (prefixed by 0x), or octal (prefixed by 0).
PHP Floating Point
Floating point numbers are numbers with a decimal part, or in exponential form.
PHP Boolean
Boolean can be TRUE or FALSE.
Boolean type is usually used for conditional judgment.
PHP Arrays
Arrays can store multiple values in one variable
PHP Objects
Object data types can also be used to store data.
In PHP, objects must be declared.
First, you must declare the class object using the class keyword. Classes are structures that can contain properties and methods.
Then we define the data type in the class and then use the data type in the instantiated class:
Example
<code><span><?php</span><span><span>class</span><span>Car</span> {</span><span>var</span><span>$color</span>; <span><span>function</span><span>Car</span><span>(<span>$color</span>=<span>"green"</span>)</span> {</span><span>$this</span>->color = <span>$color</span>; } <span><span>function</span><span>what_color</span><span>()</span> {</span><span>return</span><span>$this</span>->color; } } <span>?></span></span></code>
In the above example, the PHP keyword this is a pointer to the current object instance and does not point to any other object or class.
NULL value means the variable has no value. NULL is a value of data type NULL.
The NULL value indicates whether a variable has a null value. It can also be used to distinguish between data null values and NULL values.
You can clear variable data by setting the variable value to NULL:
The above introduces the PHP 5 data types, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.