PHP Math Functions
PHP has a set of math functions that allows you to perform mathematical tasks on numbers.
PHP pi() Function
Thepi() function returns the value of PI:
PHP min() and max() Functions
Themin() andmax() functions can be used to find the lowest or highest value in a list of arguments:
PHP abs() Function
Theabs() function returns the absolute (positive) value of a number:
PHP sqrt() Function
Thesqrt() function returns the square root of a number:
PHP round() Function
Theround() function rounds a floating-point number to its nearest integer:
Random Numbers
The PHPrand() function generates a random number:
To get more control over the random number, you can add the optionalmin andmax parameters to specify the lowest integer and the highest integer to be returned.
For example, if you want a random integer between 10 and 100 (inclusive), userand(10, 100):
Complete PHP Math Reference
For a complete reference of all math functions, go to our completePHP Math Reference.
The PHP math reference contains description and example of use, for each function.

