The pi() function returns the value of π (pi).
echo(pi()); |
The min() and max() functions can be used to determine the lowest and highest values from a list of arguments, respectively.
echo(min(0, |
The abs() function returns the absolute (positive) value of a number.
echo(abs(–6.7)); |
The sqrt() function returns the square root of a number.
echo(sqrt(64)); |
The round() function rounds a floating-point number to the nearest integer.
echo(round(0.60)); |
The rand() function generates a random number.
echo(rand()); |
To gain more control over the random number generated, you can add optional min and max parameters to define the lowest and highest integers to be returned.
For instance, to get a random integer between 10 and 100 (inclusive), use rand(10, 100).
echo(rand(10, 100)); |