convert any phone number in us number format php
$numbers = explode("\n", '(111) 222-3333
((111) 222-3333
1112223333
111 222-3333
111-222-3333
(111)2223333
+11234567890
1-8002353551
123-456-7890 -Hello!
+1 - 1234567890
');
foreach($numbers as $number)
{
print preg_replace('~.*(\d{3})[^\d]{0,7}(\d{3})[^\d]{0,7}(\d{4}).*~', '($1) $2-$3', $number). "\n";
}
Also in PHP:
- duplicate in array in php
- check if array key exists in array php
- Main features of php
- dateFormat php
- PHP message: PHP Fatal error: Uncaught TypeError: Argument 2 passed to Magento\Eav\Model\Attribute\Data\Text::validateLength() must be of the type string, null given
- download laravel
- PHP DATE 2019-10-01 FORMAT
- catch php errors
- check method in laravel
- redirect php file
- date and time function php
- add 15 days to date in loop php
- clear cache locally laravel
- Authorization header (API Key) is missing" }in guzzle
- How to Redirect Website to a Mobile Version when Accessed on a Mobile Device
- curl multi exec
- clear storage laravel
- does array have key php
- drop column migration laravel
- Laravel Google Line Chart
- char to uppercase php
- create controller in laravel command line
- envoyer mail php depuis localhost
- convert stdclass object to array php