# PHP rounding, rounding round rounding, rounding up, rounding down, fractional intercept round is what meaning rounding is an billion Excel value four five

Source: Internet
Author: User
PHP takes integer functions commonly used in four ways:

1. Direct rounding, discarding decimals, preserving integers: intval ();
2 Rounding and Rounding: round ();
3. Rounding up, there are decimals on the addition of 1:ceil ();
4. Rounding Down: Floor ().

First, intval-the variable into an integer form
Intval if it is a character type, it is automatically converted to 0.

``intval(3.14159);  // 3intval(3.64159);  // 3intval('ruesin')//0``

Second, rounding: round ()

The parameter 1 is rounded according to the specified precision of parameter 2. The parameter 2 can be a negative number or 0 (the default).

``round(3.14159);      // 3round(3.64159);      // 4round(3.641590);   // 4round(3.641592);   // 3.64round(5.641593);   // 3.642round(364159, -2);   // 364200``

Three, upward rounding, there are decimals on the addition of 1:ceil ()

Returns the next integer not less than value, in which value is entered if there is a fractional part.

This method is often used when we are writing pagination classes to calculate page counts.

``ceil(3.14159);  // 4ceil(3.64159);  // 4``

Four, downward rounding: Floor ()

Returns the next integer not less than value, rounding out the fractional part of value.

``floor(3.14159);    // 3floor(3.64159);    // 3``

'). addclass (' pre-numbering '). Hide (); \$ (this). addclass (' has-numbering '). Parent (). append (\$numbering); for (i = 1; i <= lines; i++) {\$numbering. Append (\$ ('
• '). Text (i)); }; \$numbering. FadeIn (1700); }); });

The above introduces the PHP rounding, rounding round rounding, up rounding, down rounding, fractional interception, including rounding, PHP content, I hope that the PHP tutorial interested friends have helped.

• Related Keywords:

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

## A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

• #### Sales Support

1 on 1 presale consultation

• #### After-Sales Support

24/7 Technical Support 6 Free Tickets per Quarter Faster Response

• Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.