Both ASP and PHP have a function that allows you to calculate the square root of a number. What if we wanted the cubic root of a number, or some deeper root? Calculating the root of a number is the same as raising that number to a fractional exponent.
function root(x, y)
root = x ^ (1 / y)
function root($x, $y)
return pow($x, 1/$y);
- the number you want the root of
- the depth you want to go (2 = square, 3 = cubic, etc.)