php - preg_match problem -


i have written function:

public static function isdecimal($value, $places = 2)     {         if(preg_match("/^[0-9]+(\.[0-9]{".$places."})?$/", $value)) {             return true;         } else {             return false;         }     } 

which designed test whether value being entered number/decimal number. however, if enter number "23c.32" or "2b3.23" returns true. can point out fault lies in regex?

it works fine here. problem must somewhere near function call.


Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -