PHP Verification of mobile phone number (Support attribution query and coding for UTF8) _php tips

Source: Internet
Author: User
Copy Code code as follows:

Mobile phone number Verification
function Checkmobilevalidity ($mobilephone) {
$exp = "/^13[0-9]{1}[0-9]{8}$|15[012356789]{1}[0-9]{8}$|18[012356789]{1}[0-9]{8}$|14[57]{1}[0-9]$/";
if (Preg_match ($exp, $mobilephone)) {
return true;
return false;
Mobile phone number Attribution (return: such as Guangdong Mobile)
function Checkmobileplace ($mobilephone) {
$url = "". $mobilephone. " &t= ". Time ();
$content = file_get_contents ($url);
$p = substr ($content, 56, 4);
$mo = substr ($content, 81, 4);
return $str = Conv2utf8 ($p). Conv2utf8 ($MO);
Convert string encoding to UTF8
function Conv2utf8 ($text) {
Return mb_convert_encoding ($text, ' UTF-8 ', ' ascii,gb2312,gb18030,gbk,utf-8 ');

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.