← All docs

str_pad()

Pads a string to a certain length with another string.

str_pad()

function str_pad(string $string, int $length, string $pad_string = ' ', int $pad_type = 1): string

Pads a string to a certain length with another string.

Parameters:

  • $string (string)
  • $length (int)
  • $pad_string (string), default ' ', optional
  • $pad_type (int), default 1, optional

Returns: string

No examples yet — check examples/ and showcases/ for usage patterns.

Internals

For how str_pad is implemented in the compiler, see the internals page.