<?php
use SwedishPhoneFormatter\SwedishPhoneFormatter;
$formatter = new SwedishPhoneFormatter();
$formatter->format('081234567'); // '08-123 45 67'
// Changes the area code separator
$formatter->format('081234567', ' '); // '08 123 45 67'
// Changes the area code and number separators
$formatter->format('081234567', '-', ''); // '08-1234567'
// Removes +46 country prefix and extension numbers
$formatter->format('+46 (0) 81234567'); // '08-123 45 67'
// Doesn’t try to format foreign numbers
$formatter->format('+1-202-555-0144'); // '+1-202-555-0144'
// Doesnt’t try to format non-formattable strings
$formatter->format('foobar'); // 'foobar'
// Supports number grouping for numbers without area codes
$formatter->format('112'); // '112'
$formatter->format('1177'); // '1177'
$formatter->format('11414'); // '114 14'
$formatter->format('123 456'); // '12 34 56'
$formatter->format('1234567'); // '123 45 67'
$formatter->format('12345678'); // '123 456 78'
?>
-
Notifications
You must be signed in to change notification settings - Fork 0
jfrk/swedish-phone-formatter-php
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Formatter for Swedish phone numbers
Resources
Stars
Watchers
Forks
Packages 0
No packages published