Hi all, just walked into a door with a problem I recently helped out with.
I was testing whether a value was a positive power of 10 (1,10,100 ...) -> (0,1,2 ...).
So I thought I'd use log10(). Now I know that log10() returns a float type.
But testing this:
$x = 2; $y = log10(100); echo (is_int($x)) ? "$x is an integer" : "$x is not an integer"; echo (is_int($y)) ? "$y is an integer" : "$y is not an integer";
You guessed it, $x (2) is an integer, $y (2) is not an integer. Hmm.
Any ideas about how to get around this? I purposely do not want to force $y to be an integer as that would defeat the purpose of the test.
There must be a way, but for the life of me, it's eluding me at the moment. BTW - this is no biggie - just curious.