alexsoft/leftpad

There just should be a leftpad function for PHP

v1.0.3 2019-09-16 20:03 UTC

This package is auto-updated.

Last update: 2021-07-19 00:18:10 UTC


README

A whole package is just one file with a single function leftpad(string $string, int $length, string $filler)

$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

leftpad('foo', 5) // => "  foo"

leftpad('1', 3, '0') // => "001"