PHP code example of ferryhopper / php-string-formatter

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

    

ferryhopper / php-string-formatter example snippets


use StringFormatter\StringFormatter;

$formatted = StringFormatter::apply('K563793', 'remove:space;replace:K:A;padAfterFirst:11:0');
// Returns: "K 00000563793"

padLeft:10:0;replace:_:space;padAfterFirst:11:0