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

v1.1 2022-06-01 13:43 UTC

This package is auto-updated.

Last update: 2025-09-29 02:52:20 UTC


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