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++ - Is it possible to compile a VST on linux? -

java - Output of Eclipse is rubbish -

jquery - Confused with JSON data and normal data in Django ajax request -