pad

Pads the string to a given length with $padStr.

Description

static pad(int $length, string $padStr = ' ', string $padType = 'right')

If length is less than or equal to the length of the string, no padding takes places. The default string used for padding is a space, and the default type (one of 'left', 'right', 'both') is 'right'.

Parameters

  • int $length
    Desired string length after padding.

  • string $padStr
    String used to pad, defaults to space.

  • string $padType
    One of 'left', 'right', 'both'.

Return Value

static
String after being padded.