In PHP Mathematical Function Practice 1, I introduced to you the use of max and min functions in commonly used mathematical functions. Interested friends please click here ->《max() and min() functions Interesting analysis》. As mentioned above, I will write a series of articles on mathematical functions, isn’t this coming!
In this article, we will explain to you the use of the round function. I believe everyone is familiar with the calculation of rounding. After all, this is the basic content of nine-year compulsory teaching, so the function of this function is to Numbers are rounded.
Old rules, we assume there is such a problem that needs to be solved, "Please write a PHP script to round the following values with 1 decimal digit precision".
Simply put, it is to round the specified value and retain one decimal place.
Without further ado, we also create a PHP sample file demo.php;

<?php echo round( 1.65, 1, PHP_ROUND_HALF_UP)."<br>"; // 1.7 echo round( 1.65, 1, PHP_ROUND_HALF_DOWN)."<br>"; // 1.6 echo round(-1.54, 1, PHP_ROUND_HALF_EVEN); // -1.5

PHP video tutorial!
The above is the detailed content of PHP Mathematical Function Practice 2: All-round Application of Round() Function. For more information, please follow other related articles on the PHP Chinese website!
What are the office software
localhost8080 cannot access solution
How to check for plagiarism on CNKI Detailed steps for checking for plagiarism on CNKI
What plug-ins are needed for vscode to run HTML?
Server request timeout solution
How to sort in excel
The difference between HTML and HTML5
Introduction to monitoring equipment of weather stations