The function is judged whether it is a valid postal code (fixed length), the method is simple to use regular to operate.
The code is as follows |
Copy Code |
< PHP
Function name: checkpost ($C _post) Function: Determine whether it is a valid postcode (fixed length) Parameter: $C _post (zip code to check) Return Value: Boolean value Remark: None //----------------------------------------------------------------------------------- function checkpost ($C _post) { $C _post=trim ($C _post); if (strlen ($C _post) = = 6) { if (!ereg ("^[+]?[ _0-9]*$ ", $C _post)) { return true;; }else { return false; } }else { return false;; } } ?> |
http://www.bkjia.com/PHPjc/631297.html www.bkjia.com true http://www.bkjia.com/PHPjc/631297.html techarticle The function is judged whether it is a valid postal code (fixed length), the method is simple to use regular to operate. Code to copy code like this? PHP//Function Name: Checkpost ($C _post)//role ...