php method to set an integer to a floating point number: 1. Create a new php file; 2. Create a variable to save the integer; 3. Use the floatval function to convert the integer to a floating point number.
The operating environment of this article: windows7 system, PHP7.1 version, DELL G3 computer
How to set integer to floating point number in php ?
php converts integers to floating point types
Create a new php file named test.php to explain how php converts integers to floating point types.
In the test.php file, use the header() method to set the encoding format of the page to utf-8.
In the test.php file, create a variable to hold the integer 88.
In the test.php file, use the floatval function to convert the integer to a floating point number.
In the test.php file, use var_dump to output the data type of the $num variable.
Open the test.php file in the browser to view the results.
Recommended study: "PHP Video Tutorial"
The above is the detailed content of How to set integer to floating point number in php. For more information, please follow other related articles on the PHP Chinese website!