Home >Backend Development >PHP Problem >What data types does php5 support?
1. PHP mainly has the following data types
String (string), Integer (integer), Float (floating point) type), Boolean (Boolean type), Array (array), Object (object), NULL (null value)
2. PHP integer type
1. Integer It can be a positive or negative number
2. There are three integer formats: decimal, hexadecimal (starting with 0x), octal (starting with 0)
3. PHP null value
The null value indicates that the data type is null, and the variable data can be cleared by setting the variable value to NULL.
4. PHP constants
After a constant value is defined, it cannot be changed anywhere else in the script. A constant consists of English letters, underscores, and numbers, but numbers cannot appear as the first letter. (The $ modifier is not required on the constant name).
To set a constant, use the define() function. The function syntax is as follows:
bool define ( string $name , mixed $value [, bool $case_insensitive = false ] )
case_insensitive
: Optional parameter. If set to TRUE, the constant is case-insensitive. . The default is case-sensitive.
5. PHP String
In PHP, there is only one string operator: the concatenation operator (.) is used to connect two string values. stand up.
1. The strlen() function returns the length of the string (number of characters).
2. The strpos() function is used to find a character or a specified text within a string. If a match is found in the string, the function returns the first matching character position. If no match is found, returns FALSE.
Recommended tutorial: PHP video tutorial
The above is the detailed content of What data types does php5 support?. For more information, please follow other related articles on the PHP Chinese website!