Summary of nine kinds of mathematical functions in PHP

Source: Internet
Author: User
Tags mathematical functions pow square root
This article brings you a summary of the nine kinds of mathematical functions in PHP, there is a certain reference value, the need for friends can refer to, I hope to help you.

1 max () Max ()

echo Max (Array (4,5,6)); 6

2. Minimum min ()

echo min (Array (4,5,6)); 4

3. Find square root sqrt ()

echo sqrt (16); 4

4. Rounding of floating-point numbers round ()

Two parameters passed in

Echo Round (3.725, 2); 3.73, the parameter (2) retains the number of digits after the decimal point, the default is 0 rounded result

5. Return number of N-square pow ()

Echo pow (2,3);//8

6. To take the whole floor of the FA ();

echo Floor (7.88888); 7 floating-point numbers directly out of the decimal part

7. One-way rounding ceil ()

echo ceil (9.111); 10 floating point number in one rounding

8. Absolute ABS ()

$abs = ABS (-9.9); 9.9 Numeric Absolute Number

9. Random number Mt_rand ()

echo Mt_rand (0,100);//n-> random number returns the value in the range
Related Article

Contact Us

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.