Computing limits in PHP

116 views Asked by At

I want to compute n^(2/3) as n approaches infinity in PHP.

What I tried:

$n = "INF";
echo pow($n, (2/3));

Desired result:

INF

Actual result:

0

Any suggestions? How to compute limits in PHP?

UPDATE:

OK, first problem solved - I just needed to remove the quotation mark.
But is this actually the way to calculate a limit? Is it interpreted as a limit?

1

There are 1 answers

2
Chris Forrence On BEST ANSWER

You're passing in the string "INF" into the exponential expression, which isn't valid. Try passing in just POW:

$n = INF;
echo pow($n, (2/3));
// INF