Re: Validating a "money" input
| From: | CPT John W. Holmes | Date: | Wed, 18 Jun 2003 21:24:56 +0000 |
| Subject: | Re: Validating a "money" input | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-152076@lists.php.net to get a copy of this message | ||
> What is the best way to validate a "money" input? For example, 3452.67
> versus 3452..67.
if($value == (string)round((float)$value,2))
or
if(preg_match('/^[0-9]*\.?[0-9]+$/',$value))
appear to work. :) Assuming your value is a string to start with.
---John Holmes...