PHP data type floating point type
The so-called floating point type can be understood as: the decimal in our mathematics.
[Note] Precision, value range and scientific statements are not the focus of learning. Because this block is rarely used in actual development. We label the learning of knowledge points in this block as the understanding level.
There are two declaration methods:
Common declaration
Scientific declaration
Common declaration of floating point number
<?php //声明变量fudian的值为12121.3132 $fudian = 12121.3132; echo $fudian; ?>
<?php //声明变量$fl 的值为0.8873 $fl = 0.8873; var_dump($fl); ?>
We will save the file Go to the htdocs directory of XAMPP and save the file name: float.php. In the browser address bar, enter: http://127.0.0.1/float.php, execute it and see the results, as follows:
echo directly outputs 12121.3132, and var_dump The output is 0.8873, and it also shows that the type of variable $fl is float.
var_dump() is a function. Insert variables between brackets (). This function will print out the data type and also display the length and value of the variable accordingly.
var refers to the English word for variable: variable
float Pronunciation: [floʊt]
Chinese explanation: Floating point type in computers
variable Pronunciation: [ˈveriəbl]
Chinese explanation: variable
dump Pronunciation: [dʌmp]
Chinese explanation: dump; dump;