Home > Article > Backend Development > How to remove numbers after decimal point in php
php method to remove numbers after the decimal point: 1. Create a new php file; 2. Use the header() method to set the encoding format of the page to utf-8; 3. Use the intval function to round to remove Just the number after the decimal point.
#The operating environment of this article: Windows7 system, PHP7.1, Dell G3 computer.
How to remove the numbers after the decimal point in php?
Create a new php file, named test.php, to explain how php does not need numbers after the decimal point.
In the test.php file, use the header() method to set the encoding format of the page to utf-8 to avoid outputting Chinese garbled characters.
In the test.php file, save the number to be processed in the $num variable.
In the test.php file, use the intval() function to round to remove the numbers after the decimal point.
In the test.php file, use echo to output the results.
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 remove numbers after decimal point in php. For more information, please follow other related articles on the PHP Chinese website!