PHP Classes

isNumber method

Recommend this page to a friend!

      String Object  >  All threads  >  isNumber method  >  (Un) Subscribe thread alerts  
Subject:isNumber method
Summary:The string '0' is evaluated as false
Messages:2
Author:Oliver Anan
Date:2011-06-20 17:34:24
Update:2011-06-21 17:39:34
 

  1. isNumber method   Reply   Report abuse  
Picture of Oliver Anan Oliver Anan - 2011-06-20 17:34:24
Hi,
if I use the isNumber method on the string '0' it returns 0 which is evaluated as false.

As far as I can see in the source code you use intval in the method.
But intval does not return an boolean value.

I could solve the problem with replacing intval with is_numeric.

I hope this helps.

  2. Re: isNumber method   Reply   Report abuse  
Picture of Azeem Michael Azeem Michael - 2011-06-21 17:39:34 - In reply to message 1 from Oliver Anan
Fixed. Thanks!