alexsoft / leftpad
There just should be a leftpad function for PHP
1.2.0
2024-11-05 22:09 UTC
Requires
- php: ^7.4 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0
Requires (Dev)
- phpunit/phpunit: ^9.6.9 || ^10.2.3
This package is auto-updated.
Last update: 2024-11-05 22:10:55 UTC
README
A whole package is just one file with a single function \Alexsoft\Leftpad\leftpad(string $string, int $length, string $filler): string
$string - your initial string
$length - final length of returned string
$filler - symbol with which initial string should be left padded
1. Install
composer require alexsoft/leftpad
2. Use it
\Alexsoft\Leftpad\leftpad('foo', 5) // => " foo" \Alexsoft\Leftpad\leftpad('1', 3, '0') // => "001"