Php, commonly used: php common functions-Mathematics: some common functions that are compiled during php learning. this is a mathematical function .; 12 into an integer method echoceil (7.9999 ).; 8 rounding out the integer method echofloor (7.9999 ).; 7. some common functions are sorted out during the learning of php using floating point numbers. this is a mathematical function.
Header ("Content-Type: text/html; charset = UTF-8 ");
// Obtain the absolute value abs ();
Echo abs (-12 )."
"; // 12
// Returns an integer.
Echo ceil (1, 7.9999 )."
"; // 8
// Remove the integer
Echo floor (7.9999 )."
"; // 7
// Retrieve the remainder of a floating point number
$ X = 5.7;
$ Y = 1.3;
Echo fmod ($ x, $ y )."
"; // 0.5 1.3 0.5*4 + 5.7 =
/*
* $ X = 3.6;
* $ Y = 0.6;
* Echo $ r = fmod ($ x, $ y );
* If there is no remainder, unexpected results may occur.
*/
// Returns the n power of the number.
Echo pow (5, 3 )."
"; // The third time of 125 5 is 125
// Rounding floating point numbers
Echo round (1.95583, 2 )."
"; // 1.96
// Calculate the square root
Echo sqrt (64 )."
"; // 8
// Calculate the maximum and minimum values (the parameter cannot be a variable)
Echo max (1, 3, 5, 7, 9 )."
"; // 9
Echo min (5, 7, 9 )."
"; // 5
Echo max (array (1, 3, 5, 7, 9 ))."
"; // 9
Echo min (array (3,5, 7,9 ))."
"; // 3
// Random number
Echo mt_rand (0, 4 )."
"; // Random
Echo rand (5, 9 )."
"; // Random
// Obtain the circumference rate
Echo pi (); // 3.1415926535898
The above describes common php functions-mathematics, including php and common content. I hope my friends who are interested in PHP tutorials will be helpful.