1. Go to this page and download the library: Download blobfolio/blob-phone 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/ */
blobfolio / blob-phone example snippets
$phone = new blobfolio\phone\phone($phone_number, $country_code='US');
if ($phone->is_phone($types=array())) {
...
}
// If you only want the number, you can typecast it:
$formatted = (string) $phone; //+598 9423 1234
// If you want more details:
print_r($phone->get_data());
/*
Array(
[country] => CA
[prefix] => 1
[region] => North America
[types] => Array(
[0] => fixed
[1] => mobile
)
[number] => +1 204-234-5678
)
*/
$phone = '1012345678';
$country = 'CN';
$phone = (string) blobfolio\phone\phone($phone, $country);
if (strlen($phone)) {
echo "Your pretty phone number is: $phone";
}
else {
echo "I don't think that was right...";
}
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.