PHP code example of rodrigoaramburu / php-mask

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

    

rodrigoaramburu / php-mask example snippets


$output = Mask::apply('123','###.###');
//output: 123.000

$output = Mask::apply('1234','###.###', '-');
//output: 123.4--

$output = Mask::apply('1234','###.###', null, Mask::DIRECTION_RIGHT);
//output: 001.234

$output = Mask::apply('12345','C-####');
//output: C-1234

$output = Mask::apply('123456789','C-#.#.#*');
//output: C-1.2.3456789