RE: [PHP] Re: Perfect Squares

2004-05-25 Thread Stephen Craton
: Jason Barnett [mailto:[EMAIL PROTECTED] - Sent: Tuesday, May 25, 2004 6:59 PM - To: [EMAIL PROTECTED] - Subject: [PHP] Re: Perfect Squares - - Stephen Craton wrote: - - > I'm in a bit of a pickle. I need to find out if a variable is a perfect - > square or not, and this needs to test f

[PHP] Re: Perfect Squares

2004-05-25 Thread Jason Barnett
Stephen Craton wrote: I'm in a bit of a pickle. I need to find out if a variable is a perfect square or not, and this needs to test for decimal numbers as well, such as 2.25. The thing is, the only function I've found in PHP is gmp_perfect_square() which isn't supported on my web server, and I don'

[PHP] Re: Perfect Squares

2004-05-25 Thread Jason Barnett
John Kaspar wrote: Try taking the square root of the variable $sqrt = sqrt($var); then compare the number of decimal places. if (strlen(strstr($sqrt,".")) <= strlen(strstr($var,"."))) { // perfect } Just guessing of course. I'd do something similar, but a little different: $sqrt = sqrt($var); i

[PHP] Re: Perfect Squares

2004-05-25 Thread John Kaspar
Try taking the square root of the variable $sqrt = sqrt($var); then compare the number of decimal places. if (strlen(strstr($sqrt,".")) <= strlen(strstr($var,"."))) { // perfect } Just guessing of course. On 5/25/2004 5:06 PM, Stephen Craton wrote: I'm in a bit of a pickle. I need to find o