Home > php教程 > php手册 > PHP手机号验证函数(13,14,15,17,18)

PHP手机号验证函数(13,14,15,17,18)

WBOY
Release: 2016-06-06 19:38:06
Original
2204 people have browsed it

无详细内容 无 /** * 验证是否是手机号码 * * @param string $phone 待验证的号码 * @return boolean 如果验证失败返回false,验证成功返回true */function isTelNumber($phone) {if (strlen ( $phone ) != 11 || ! preg_match ( '/^1[3|4|5|7|8][0-9]\d{4,8}$

/**
 * 验证是否是手机号码
 *
 * @param string $phone 待验证的号码
 * @return boolean 如果验证失败返回false,验证成功返回true
 */
function isTelNumber($phone) {
	if (strlen ( $phone ) != 11 || ! preg_match ( '/^1[3|4|5|7|8][0-9]\d{4,8}$/', $phone )) {
        return false;
    } else {
        return true;
    }
}
Copy after login
source:php.cn
Statement of this Website
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template