Home  >  Article  >  Backend Development  >  A small function written in PHP to check whether the data is in currency format

A small function written in PHP to check whether the data is in currency format

WBOY
WBOYOriginal
2016-07-25 09:07:071042browse
  1. // Function name: CheckMoney($C_Money)
  2. // Function: Check whether the data is in 99999.99 format
  3. // Parameter: $C_Money (the number to be detected)
  4. // Return value: Boolean value
  5. //Remarks: None
  6. function CheckMoney($C_Money)
  7. {
  8. if (!ereg(“^[0-9][.][0-9]$”, $C_Money)) return false;
  9. return true;
  10. }
  11. ?>
Copy code


Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn