PHP code example of xudongyss / phonenumber
1. Go to this page and download the library: Download xudongyss/phonenumber library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
xudongyss / phonenumber example snippets
use phonenumber\PhoneNumber;
/* 国际区号:86:中国,856:香港 */
$countryCallingCode = '86';
$phoneNumber = '';
$phoneNumber = PhoneNumber::isMobile($countryCallingCode, $phoneNumber);
// false or libphonenumber\PhoneNumber Object
var_dump($phoneNumber);
$phoneNumber = PhoneNumber::isPhoneNumber($countryCallingCode, $phoneNumber);
// false or libphonenumber\PhoneNumber Object
var_dump($phoneNumber);
/* $phoneNumber 手机号码对象或者 电话号码对象 */
PhoneNumber::getNationalNumber($phoneNumber);