How to check if an entered value is currency. Preferably by regular expression or php function.
(values like 1550.50
, 1500
or 100.75
)
How to check if an entered value is currency. Preferably by regular expression or php function.
(values like 1550.50
, 1500
or 100.75
)
You can't be sure. The user might be thinking of chickens. You need to check if the user entered a float. Have a look at preg_match: http://jp2.php.net/manual/en/function.preg-match.php
You also need to ask yourself if you want to try to work with what the user entered, or if you want to reject it and only accept an exact format.