Front-end PHP entry -019-mathematical functions of built-in functions-very important

Source: Internet
Author: User
Tags mathematical functions ord pow

View Help documents primarily

Name of function Description Example input Output
ABS () Seek absolute value $abs = ABS (-4.2); 4.2 Digital Absolute number
Ceil () into a method to take the whole echo ceil (9.999); 10 Floating point number into a rounding
Floor () Rounding out the whole method of rounding echo Floor (9.999); 9 Floating point number Go directly to the decimal parts
Fmod () Floating-point number to take surplus " x = 5.7 x = 5.7 ; y = 1.3; r=fmod( r = f m o d ( X y ) ; < span class= "Mo" id= "mathjax-span-23" style= "Font-family:mathjax_main;" >/ / y ) ; / / R equals 0.5, because 4 * 1.3 + 0.5 = 5.7 " Two floating-point numbers, x>y Floating-point remainder
POW () Returns the number of the n-th square Echo Pow (-1, 20); 1 Base number n-th square exponentiation value
Round () Floating-point rounding Echo Round (1.95583, 2);//1.96 A numeric value How many bits are reserved after the decimal point, the default is 0 rounded results
sqrt () Find square root echo sqrt (9); 3 The number of the being prescribed Square root
Max () To find the maximum value "Echo Max (1, 3, 5, 6, 7); 7 echo Max (Array (2, 4, 5)); 5 " Multiple numbers or arrays Returns the maximum value
Min () To find the minimum value Min Multiple numbers or arrays Returns the minimum value
Mt_rand () A better random number echo Mt_rand (0,9);//n Min/MAX, random number Values in the range returned randomly
RAND () Random number echo rand () Min/MAX, random number Values in the range returned randomly
Pi () Get the PI value echo Pi (); 3.1415926535898 No Get pi


From for notes (Wiz)

Front-end PHP entry -019-mathematical functions of built-in functions-very important

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.