
Michael Richey - 2023-02-19 22:27:23
I hate to do this to you, because you obviously put work into this class. This can be accomplished with a single built-in function.
#Cube root of 27:
echo pow(27,1/3); // returns 3
#4th root of 256:
echo pow(256,1/4); // returns 4
#5th root of 3125:
echo pow(3125,1/5); // returns 5
#6th root of 46656:
echo pow(46656,1/6); // returns 6
#7th root of 823543:
echo pow(823543,1/7); // returns 7
It isn't necessary to use a fraction, you can substitute a float if you know it - or if you calculate it another way. pow() treats 1/4 the same as 0.25.