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
Post a Comment