Just a simple function to see if an input numeric value is actually a US Dollar (USD) format\r\nExample:\r\nTwo Dollar Amounts provided to the script.. 1502.38 and 10O.00\r\n\r\nGood: 1,502.38\r\nBad: 10O.00 came back false. \r\n\r\n
\r\nfunction verifyMoney($what){\r\n   if (preg_match('#^[0-9]+(\.[0-9]{0,2})?$#', $what)){\r\n     $monkey = number_format($what, 2);\r\n     return $monkey;\r\n   }else{ return FALSE; }\r\n}\r\n\r\n$goodmoney = "1502.38";\r\n$badmoney = "10O.00";\r\nif(verifyMoney($goodmoney) !== FALSE) {echo "Good: ".verifyMoney($goodmoney);}else{echo "The Dollar amount you have entered is not valid";}\r\nif(verifyMoney($badmoney) == FALSE) {echo "Bad: ".$badmoney." came back false.";}else{echo "The Dollar amount you have entered is valid";}\r\n