In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-26 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article introduces the relevant knowledge of "what are the scalar data types in php". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!
There are four scalar data types in php: 1, boolean (Boolean), with only two values true and false; 2, string (string), which is a continuous sequence of strings composed of numbers, letters and symbols; 3, integer (integer); 4, float (floating point).
Operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
The data types of PHP can be divided into three categories: scalar data types, compound data types and special data types.
Among them, the scalar data type is the most basic unit of the data structure, which can only store one data. There are four types of scalar data in PHP, as shown in the following table:
Type function boolean (Boolean) the simplest data type, only two values: true (true) / false (false) string (string) string is a continuous sequence of characters integer (integer) integer contains all integers, can be positive or negative float (floating point) floating-point type is also used to represent numbers, unlike integers, it can also be used to represent decimals and exponents
1. Boolean (boolean)
Boolean is one of the most commonly used data types in PHP, which holds a true value or false value, 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 Boolean values are false, but also non-Boolean values are considered to be false in some special cases. For example, 0, an empty string and only an array that declares no assignment.
2. Character string (string)
A string is a continuous sequence of strings consisting of numbers, letters, and symbols. Each character in the string takes up only one byte. There are three ways to define a string, single quotation marks, double quotation marks, and delimiters
Run the above code, and the result is as follows:
Int (5985) int (- 345,140) int (39)
4. Floating point (float)
Floating-point data types can be used to store both integers and decimals.
Floating-point types, known as float types in PHP, also known as real numbers, can be used to store integers and decimals, and valid values range from 1.8E-308 to 1.8E+308. Floating-point numbers are more accurate than integer data types.
The sample code is as follows:
The running results are as follows:
Float (10.365) float (2400) float (8.0E-5) "what are the scalar data types in php" is introduced here. Thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.