PHP Basic Tutorial
MySQL Connection
PHP Advanced
PHP OOP
There are various built-in functions available for performing mathematical operations. Here's an overview of some of the common PHP math functions:
| Function | Description | Example | 
|---|---|---|
| pi() | Returns the value of π (Pi), which is approximately 3.1415926535898 | |
| min() and max() | Returns the smallest or largest value in an array or a set of values | |
| abs() | Returns the absolute value of a number | |
| pow() | Returns the base raised to the power of the exponent | |
| sqrt() | Returns the square root of a number | |
| round() | Rounds a floating-point number | |
| floor() | Rounds a number down to the nearest integer | |
| ceil() | Rounds a number up to the nearest integer | |
| rand() | Function generates a random number | 
However, you can also specify a range for the random number by passing two arguments: a minimum and maximum value.
Syntax
rand(int $min = 0, int $max = getrandmax())
getrandmax() (the largest possible random value).Try it yourself