PHP code example of tentwofour / formatter

1. Go to this page and download the library: Download tentwofour/formatter 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/ */

    

tentwofour / formatter example snippets


MoneyFormatter::dollarsToCents(12.00);
// => 1200

MoneyFormatter::dollarsToCents(1200);
// => 12.00

$f = new PhoneNumberFormatter('+14239170989');

$formatted = $f->format()
// => +1 (423) 917-0989

$f->setPhoneNumber($formatted);
$reverse = $f->reverseFormat();
// => +14239170989

$f = new PostalCodeFormatter('H0H 0H0');

$formatted = $f->format()
// => h0h0h0 

$f->setPostalCode($formatted);
$reverse = $f->reverseFormat();
// => H0H 0H0