carloscarucce / mb-str-pad
Binary safe behavior for str_pad
Installs: 149
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/carloscarucce/mb-str-pad
Requires
- ext-mbstring: *
Requires (Dev)
- phpunit/phpunit: >=5.4
README
Installing
composer require carloscarucce/mb-str-pad
Usage
include 'vendor/autoload.php'; $input = 'My text'; $length = 20; $padding = ' '; // Optional. Default: ' ' $padType = STR_PAD_RIGHT; // Optional. Use STR_PAD_RIGHT, STR_PAD_LEFT or STR_PAD_BOTH. Default: STR_PAD_RIGHT $encoding = null; //Optional. Default: null $result = mb_str_pad($input, $length, $padding, $padType, $encoding); var_dump($result); // string(20) "My text "
Run tests:
composer test