PHP Basic Tutorial
MySQL Connection
There are various built-in functions available for performing mathematical operations. Here's an overview of some of the common PHP math functions:
pi()
function returns the value of π (Pi), which is approximately 3.1415926535898.
The min()
and max()
functions can be used to returns the smallest or largest value in an array or a set of values.
Try it yourself
The abs()
function returns the absolute value of a number.
The pow()
function returns the base raised to the power of the exponent.
The sqrt()
function returns the square root of a number..
The round()
function rounds a floating-point number.
Try it yourself
The floor()
function rounds a number down to the nearest integer.
The ceil()
function rounds a number up to the nearest integer.
The rand()
function generates a random number.
Try it yourself
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