Operators and Operands:
There are several ways to round a number in PHP. One way is to simply round the number
in the traditional way (anything .5 or over goes up, under goes down.) You can also use ceil
to round all numbers up, or use floor
to round all numbers down.
Roots and Exponents:
You can raise a number to any power in PHP using the pow () function.
Similarly you can find its root. To find the square root you would use sqrt ()
The absolute value of a number, is the distance a number is from 0, and is always a positive number. The absolute value
function in PHP produces this for us.
Numbers are formatted differently in different parts of the world. In the US, it is common to format using commas and periods such as: 1,000,000.00 In PHP we can set our numbers to format
however we want, to make them the most useful for us.
Max and Min Functions:
The max () and min () functions can be used to find the highest or lowest number in a group of numbers, arrays, and strings. The max () function
is used to find the highest, and the min () function
is used to find the lowest.