/ Published in: PHP
This function allows you to calculate the root of a number beyond just square root.
- Copyright (c) 2008, reusablecode.blogspot.com; some rights reserved.
- This work is licensed under the Creative Commons Attribution License. To view
- a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or
- send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California
- 94305, USA.
- // Calculate root to a given depth (square root, cubic root, etc.)
- // x is what you want the root of
- // y is the depth you want to go (2 = square, 3 = cubic, etc.)
- function root($x, $y)
- return pow($x, 1/$y);
You need to login to post a comment.